gpio: em: remove the gpiochip before removing the irq domain
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Thu, 11 Jul 2019 08:29:35 +0000 (10:29 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 15 Jul 2019 09:52:42 +0000 (11:52 +0200)
commit19ec11a2233d24a7811836fa735203aaccf95a23
tree7592b66de7d4b45caf883cc5937fac14a053ef57
parent89fea04c85e85f21ef4937611055abce82330d48
gpio: em: remove the gpiochip before removing the irq domain

In commit 8764c4ca5049 ("gpio: em: use the managed version of
gpiochip_add_data()") we implicitly altered the ordering of resource
freeing: since gpiochip_remove() calls gpiochip_irqchip_remove()
internally, we now can potentially use the irq_domain after it was
destroyed in the remove() callback (as devm resources are freed after
remove() has returned).

Use devm_add_action_or_reset() to keep the ordering right and entirely
kill the remove() callback in the driver.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: 8764c4ca5049 ("gpio: em: use the managed version of gpiochip_add_data()")
Cc: stable@vger.kernel.org
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/gpio/gpio-em.c