spi: sh-hspi: fix controller deregistration

Make sure to deregister the controller before releasing underlying
resources like clocks during driver unbind.

Fixes: 49e599b859 ("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>
This commit is contained in:
Johan Hovold 2026-04-10 10:17:42 +02:00 committed by Mark Brown
parent c1446b61e4
commit e63982e639
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View 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[] = {