]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPI / gpio: add missing fwnode_handle_put() in acpi_gpiochip_scan_gpios()
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 29 Oct 2016 16:11:57 +0000 (16:11 +0000)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 31 Oct 2016 08:18:29 +0000 (09:18 +0100)
fwnode_handle_put() should be used when terminating
device_for_each_child_node() iteration with break or
return to prevent stale device node references from
being left behind.

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-acpi.c

index 53266ef120086e57a2bb54c3ec5bc14954b98176..aa879d5eaa19e1ff1986f6286374ca9140291500 100644 (file)
@@ -922,6 +922,7 @@ static void acpi_gpiochip_scan_gpios(struct acpi_gpio_chip *achip)
                ret = gpiod_hog(desc, name, lflags, dflags);
                if (ret) {
                        dev_err(chip->parent, "Failed to hog GPIO\n");
+                       fwnode_handle_put(fwnode);
                        return;
                }
        }