hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/input/keyboard/mtk-pmic-keys.c
....@@ -1,31 +1,21 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2017 MediaTek, Inc.
34 *
45 * Author: Chen Zhong <chen.zhong@mediatek.com>
5
- *
6
- * This software is licensed under the terms of the GNU General Public
7
- * License version 2, as published by the Free Software Foundation, and
8
- * may be copied, distributed, and modified under those terms.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
156 */
167
17
-#include <linux/module.h>
18
-#include <linux/kernel.h>
198 #include <linux/input.h>
209 #include <linux/interrupt.h>
21
-#include <linux/platform_device.h>
2210 #include <linux/kernel.h>
23
-#include <linux/of.h>
24
-#include <linux/of_device.h>
25
-#include <linux/regmap.h>
2611 #include <linux/mfd/mt6323/registers.h>
27
-#include <linux/mfd/mt6397/registers.h>
2812 #include <linux/mfd/mt6397/core.h>
13
+#include <linux/mfd/mt6397/registers.h>
14
+#include <linux/module.h>
15
+#include <linux/of_device.h>
16
+#include <linux/of.h>
17
+#include <linux/platform_device.h>
18
+#include <linux/regmap.h>
2919
3020 #define MTK_PMIC_PWRKEY_RST_EN_MASK 0x1
3121 #define MTK_PMIC_PWRKEY_RST_EN_SHIFT 6
....@@ -287,8 +277,10 @@
287277 keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];
288278
289279 keys->keys[index].irq = platform_get_irq(pdev, index);
290
- if (keys->keys[index].irq < 0)
280
+ if (keys->keys[index].irq < 0) {
281
+ of_node_put(child);
291282 return keys->keys[index].irq;
283
+ }
292284
293285 error = of_property_read_u32(child,
294286 "linux,keycodes", &keys->keys[index].keycode);
....@@ -296,6 +288,7 @@
296288 dev_err(keys->dev,
297289 "failed to read key:%d linux,keycode property: %d\n",
298290 index, error);
291
+ of_node_put(child);
299292 return error;
300293 }
301294
....@@ -303,8 +296,10 @@
303296 keys->keys[index].wakeup = true;
304297
305298 error = mtk_pmic_key_setup(keys, &keys->keys[index]);
306
- if (error)
299
+ if (error) {
300
+ of_node_put(child);
307301 return error;
302
+ }
308303
309304 index++;
310305 }