summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-06-21 17:17:20 +0200
committerSebastian Reichel <sre@kernel.org>2022-07-17 01:05:54 +0200
commitc9d8468158adca6dffd2ff5b1befd35f75568b10 (patch)
treef77830d0e8878a8c8667aa9a2cdbff0f3ba48b75 /drivers/power
parentpower: supply: ab8500: add missing destroy_workqueue in ab8500_charger_bind (diff)
downloadlinux-c9d8468158adca6dffd2ff5b1befd35f75568b10.tar.xz
linux-c9d8468158adca6dffd2ff5b1befd35f75568b10.zip
power: supply: olpc_battery: Hold the reference returned by of_find_compatible_node
In olpc_battery_probe(), we should hold the reference returned by of_find_compatible_node() and use it to call of_node_put() for refcount balance. Signed-off-by: Liang He <windhl@126.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/olpc_battery.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
index e0476ec06601..a5da20ffd685 100644
--- a/drivers/power/supply/olpc_battery.c
+++ b/drivers/power/supply/olpc_battery.c
@@ -635,6 +635,7 @@ static int olpc_battery_probe(struct platform_device *pdev)
struct power_supply_config bat_psy_cfg = {};
struct power_supply_config ac_psy_cfg = {};
struct olpc_battery_data *data;
+ struct device_node *np;
uint8_t status;
uint8_t ecver;
int ret;
@@ -649,7 +650,9 @@ static int olpc_battery_probe(struct platform_device *pdev)
if (ret)
return ret;
- if (of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec")) {
+ np = of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec");
+ if (np) {
+ of_node_put(np);
/* XO 1.75 */
data->new_proto = true;
data->little_endian = true;