]> git.hungrycats.org Git - linux/commit
gpio: fix memory and reference leaks in gpiochip_add error path
authorJohan Hovold <johan@kernel.org>
Mon, 12 Jan 2015 16:12:24 +0000 (17:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Jan 2015 16:29:41 +0000 (08:29 -0800)
commite1c76d694f656d593f5a6d001e6fec04d7252b7c
tree3db9f02d1df4b4659f56003cca4da1ae642bb245
parentfe7930b607e8f7d238495390a4c262ffbdab1506
gpio: fix memory and reference leaks in gpiochip_add error path

commit 5539b3c938d64a60cb1fc442ac3ce9263d52de0c upstream.

Memory allocated and references taken by of_gpiochip_add and
acpi_gpiochip_add were never released on errors in gpiochip_add (e.g.
failure to find free gpio range).

Fixes: 391c970c0dd1 ("of/gpio: add default of_xlate function if device
has a node pointer")
Fixes: 664e3e5ac64c ("gpio / ACPI: register to ACPI events
automatically")

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpiolib.c