Skip to content
Commit d98bdd3a authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Wolfram Sang
Browse files

i2c: imx: Make sure to unregister adapter on remove()

If for whatever reasons pm_runtime_resume_and_get() fails and .remove() is
exited early, the i2c adapter stays around and the irq still calls its
handler, while the driver data and the register mapping go away. So if
later the i2c adapter is accessed or the irq triggers this results in
havoc accessing freed memory and unmapped registers.

So unregister the software resources even if resume failed, and only skip
the hardware access in that case.

Fixes: 588eb93e

 ("i2c: imx: add runtime pm support to improve the performance")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 3df71d70
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment