.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2017 MediaTek, Inc. |
---|
3 | 4 | * |
---|
4 | 5 | * 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 | | - * |
---|
15 | 6 | */ |
---|
16 | 7 | |
---|
17 | | -#include <linux/module.h> |
---|
18 | | -#include <linux/kernel.h> |
---|
19 | 8 | #include <linux/input.h> |
---|
20 | 9 | #include <linux/interrupt.h> |
---|
21 | | -#include <linux/platform_device.h> |
---|
22 | 10 | #include <linux/kernel.h> |
---|
23 | | -#include <linux/of.h> |
---|
24 | | -#include <linux/of_device.h> |
---|
25 | | -#include <linux/regmap.h> |
---|
26 | 11 | #include <linux/mfd/mt6323/registers.h> |
---|
27 | | -#include <linux/mfd/mt6397/registers.h> |
---|
28 | 12 | #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> |
---|
29 | 19 | |
---|
30 | 20 | #define MTK_PMIC_PWRKEY_RST_EN_MASK 0x1 |
---|
31 | 21 | #define MTK_PMIC_PWRKEY_RST_EN_SHIFT 6 |
---|
.. | .. |
---|
287 | 277 | keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index]; |
---|
288 | 278 | |
---|
289 | 279 | 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); |
---|
291 | 282 | return keys->keys[index].irq; |
---|
| 283 | + } |
---|
292 | 284 | |
---|
293 | 285 | error = of_property_read_u32(child, |
---|
294 | 286 | "linux,keycodes", &keys->keys[index].keycode); |
---|
.. | .. |
---|
296 | 288 | dev_err(keys->dev, |
---|
297 | 289 | "failed to read key:%d linux,keycode property: %d\n", |
---|
298 | 290 | index, error); |
---|
| 291 | + of_node_put(child); |
---|
299 | 292 | return error; |
---|
300 | 293 | } |
---|
301 | 294 | |
---|
.. | .. |
---|
303 | 296 | keys->keys[index].wakeup = true; |
---|
304 | 297 | |
---|
305 | 298 | error = mtk_pmic_key_setup(keys, &keys->keys[index]); |
---|
306 | | - if (error) |
---|
| 299 | + if (error) { |
---|
| 300 | + of_node_put(child); |
---|
307 | 301 | return error; |
---|
| 302 | + } |
---|
308 | 303 | |
---|
309 | 304 | index++; |
---|
310 | 305 | } |
---|