]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 20 Aug 2021 15:38:13 +0000 (17:38 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 5 Nov 2021 09:19:34 +0000 (10:19 +0100)
commite6f5303d79693c743622d18740260ba744ea629b
tree6d8905e906ea78fbc0afe4e46998cdc6495c6a86
parent791807057cad1a951e92cc8335cb536160f42b8f
gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak

BugLink: https://bugs.launchpad.net/bugs/1948873
[ Upstream commit 889a1b3f35db6ba5ba6a0c23a3a55594570b6a17 ]

If an error occurs after a 'gpiochip_add_data()' call it must be undone by
a corresponding 'gpiochip_remove()' as already done in the remove function.

To simplify the code a fix a leak in the error handling path of the probe,
use the managed version instead (i.e. 'devm_gpiochip_add_data()')

Fixes: 698b8eeaed72 ("gpio/mpc8xxx: change irq handler from chained to normal")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/gpio/gpio-mpc8xxx.c