Commit d98bdd3
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: 588eb93 ("i2c: imx: add runtime pm support to improve the performance")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>1 parent 3df71d7 commit d98bdd3
1 file changed
Lines changed: 11 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1572 | 1572 | | |
1573 | 1573 | | |
1574 | 1574 | | |
1575 | | - | |
1576 | | - | |
1577 | | - | |
| 1575 | + | |
1578 | 1576 | | |
1579 | 1577 | | |
1580 | 1578 | | |
| |||
1585 | 1583 | | |
1586 | 1584 | | |
1587 | 1585 | | |
1588 | | - | |
1589 | | - | |
1590 | | - | |
1591 | | - | |
1592 | | - | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
1593 | 1594 | | |
1594 | 1595 | | |
1595 | 1596 | | |
1596 | 1597 | | |
1597 | 1598 | | |
1598 | | - | |
| 1599 | + | |
| 1600 | + | |
1599 | 1601 | | |
1600 | 1602 | | |
1601 | 1603 | | |
| |||
0 commit comments