]> git.baikalelectronics.ru Git - kernel.git/commit
spi: atmel-quadspi: Free resources even if runtime resume failed in .remove()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 17 Mar 2023 08:42:31 +0000 (09:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:27 +0000 (23:03 +0900)
commit984092ad6abf97c9f481c9e554ac5c69ad58ba83
treeb608c5a0e7416254fbdfcbb83f5cf1afe1e5ddc4
parent0ccf4c46e66ed3e9f0e8cdfe257863ae17ef09e1
spi: atmel-quadspi: Free resources even if runtime resume failed in .remove()

[ Upstream commit 9448bc1dee65f86c0fe64d9dea8b410af0586886 ]

An early error exit in atmel_qspi_remove() doesn't prevent the device
unbind. So this results in an spi controller with an unbound parent
and unmapped register space (because devm_ioremap_resource() is undone).
So using the remaining spi controller probably results in an oops.

Instead unregister the controller unconditionally and only skip hardware
access and clk disable.

Also add a warning about resume failing and return zero unconditionally.
The latter has the only effect to suppress a less helpful error message by
the spi core.

Fixes: 116cde1ca913 ("spi: atmel-quadspi: add runtime pm support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/20230317084232.142257-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/atmel-quadspi.c