Unverified Commit e63982e6 authored by Johan Hovold's avatar Johan Hovold Committed by Mark Brown
Browse files

spi: sh-hspi: fix controller deregistration



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

Fixes: 49e599b8 ("spi: sh-hspi: control spi clock more correctly")
Cc: stable@vger.kernel.org	# 3.4
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260410081757.503099-13-johan@kernel.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c1446b61
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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[] = {