]> Git Repo - linux.git/commitdiff
power: supply: olpc_battery: Hold the reference returned by of_find_compatible_node
authorLiang He <[email protected]>
Tue, 21 Jun 2022 15:17:20 +0000 (23:17 +0800)
committerSebastian Reichel <[email protected]>
Sat, 16 Jul 2022 23:05:54 +0000 (01:05 +0200)
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]>
drivers/power/supply/olpc_battery.c

index e0476ec06601d259cfcbeff59032eddd72da00f7..a5da20ffd6852e875e1924eb6b624cb11e878eff 100644 (file)
@@ -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;
This page took 0.065114 seconds and 4 git commands to generate.