]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: sh-hspi: fix controller deregistration
authorJohan Hovold <johan@kernel.org>
Fri, 10 Apr 2026 08:17:42 +0000 (10:17 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 10 Apr 2026 12:22:33 +0000 (13:22 +0100)
Make sure to deregister the controller before releasing underlying
resources like clocks during driver unbind.

Fixes: 49e599b8595f ("spi: sh-hspi: control spi clock more correctly")
Cc: stable@vger.kernel.org # 3.4
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260410081757.503099-13-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sh-hspi.c

index e03eaca1b1a7c4962a51992cacf4e0dee4f175e2..1e3ca718ca736c02c808351b5a06a3435c046a47 100644 (file)
@@ -257,9 +257,9 @@ static int hspi_probe(struct platform_device *pdev)
        ctlr->transfer_one_message = hspi_transfer_one_message;
        ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
 
-       ret = devm_spi_register_controller(&pdev->dev, ctlr);
+       ret = spi_register_controller(ctlr);
        if (ret < 0) {
-               dev_err(&pdev->dev, "devm_spi_register_controller error.\n");
+               dev_err(&pdev->dev, "failed to register controller\n");
                goto error2;
        }
 
@@ -279,9 +279,15 @@ static void hspi_remove(struct platform_device *pdev)
 {
        struct hspi_priv *hspi = platform_get_drvdata(pdev);
 
+       spi_controller_get(hspi->ctlr);
+
+       spi_unregister_controller(hspi->ctlr);
+
        pm_runtime_disable(&pdev->dev);
 
        clk_put(hspi->clk);
+
+       spi_controller_put(hspi->ctlr);
 }
 
 static const struct of_device_id hspi_of_match[] = {