]> git.baikalelectronics.ru Git - 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)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 31 Aug 2021 10:10:24 +0000 (12:10 +0200)
commit9b96d61d8728b09a7d3cf097eb8484a629fd20ae
tree779cf1fe8e802cba1a3e796ac65f1abe34ff469f
parent75ead83ab821d9e1f6e7c3a5635626437c21393d
gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak

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: 6b92ad2905b7 ("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>
drivers/gpio/gpio-mpc8xxx.c