[PATCH 19/20] spi: microchip-core-spi: fix controller deregistration

Johan Hovold
2026-04-09T12:05:26Z

Make sure to deregister the controller before disabling underlying
resources like interrupts during driver unbind.

Fixes: 059f545832be ("spi: add support for microchip "soft" spi controller")
Cc: stable@vger.kernel.org # 6.19
Cc: Prajna Rajendra Kumar <prajna.rajendrakumar@microchip.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-microchip-core-spi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-microchip-core-spi.c b/drivers/spi/spi-microchip-core-spi.c
index a4c128ae391b..be01c178e2b0 100644
--- a/drivers/spi/spi-microchip-core-spi.c
+++ b/drivers/spi/spi-microchip-core-spi.c
@@ -384,7 +384,7 @@ static int mchp_corespi_probe(struct platform_device *pdev)

mchp_corespi_init(host, spi);

- ret = devm_spi_register_controller(dev, host);
+ ret = spi_register_controller(host);
if (ret) {
mchp_corespi_disable_ints(spi);
mchp_corespi_disable(spi);
@@ -399,6 +399,8 @@ static void mchp_corespi_remove(struct platform_device *pdev)
struct spi_controller *host = platform_get_drvdata(pdev);
struct mchp_corespi *spi = spi_controller_get_devdata(host);

+ spi_unregister_controller(host);
+
mchp_corespi_disable_ints(spi);
mchp_corespi_disable(spi);
}
--
2.52.0