Skip to content

Commit c9d8468

Browse files
windhlsre
authored andcommitted
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 <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 38d4544 commit c9d8468

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/power/supply/olpc_battery.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ static int olpc_battery_probe(struct platform_device *pdev)
635635
struct power_supply_config bat_psy_cfg = {};
636636
struct power_supply_config ac_psy_cfg = {};
637637
struct olpc_battery_data *data;
638+
struct device_node *np;
638639
uint8_t status;
639640
uint8_t ecver;
640641
int ret;
@@ -649,7 +650,9 @@ static int olpc_battery_probe(struct platform_device *pdev)
649650
if (ret)
650651
return ret;
651652

652-
if (of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec")) {
653+
np = of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec");
654+
if (np) {
655+
of_node_put(np);
653656
/* XO 1.75 */
654657
data->new_proto = true;
655658
data->little_endian = true;

0 commit comments

Comments
 (0)