Skip to content

Commit

Permalink
ACPI / gpio: add missing fwnode_handle_put() in acpi_gpiochip_scan_gp…
Browse files Browse the repository at this point in the history
…ios()

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>
  • Loading branch information
Wei Yongjun authored and Linus Walleij committed Oct 31, 2016
1 parent 5a195c6 commit 1b6998c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpio/gpiolib-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 1b6998c

Please sign in to comment.