Skip to content

Commit 59da4cd

Browse files
jhovoldgregkh
authored andcommitted
spi: sh-hspi: fix controller deregistration
commit e63982e upstream. Make sure to deregister the controller before releasing underlying resources like clocks during driver unbind. Fixes: 49e599b ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 863edec commit 59da4cd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/spi/spi-sh-hspi.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ static int hspi_probe(struct platform_device *pdev)
258258
ctlr->transfer_one_message = hspi_transfer_one_message;
259259
ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
260260

261-
ret = devm_spi_register_controller(&pdev->dev, ctlr);
261+
ret = spi_register_controller(ctlr);
262262
if (ret < 0) {
263-
dev_err(&pdev->dev, "devm_spi_register_controller error.\n");
263+
dev_err(&pdev->dev, "failed to register controller\n");
264264
goto error2;
265265
}
266266

@@ -280,9 +280,15 @@ static void hspi_remove(struct platform_device *pdev)
280280
{
281281
struct hspi_priv *hspi = platform_get_drvdata(pdev);
282282

283+
spi_controller_get(hspi->ctlr);
284+
285+
spi_unregister_controller(hspi->ctlr);
286+
283287
pm_runtime_disable(&pdev->dev);
284288

285289
clk_put(hspi->clk);
290+
291+
spi_controller_put(hspi->ctlr);
286292
}
287293

288294
static const struct of_device_id hspi_of_match[] = {

0 commit comments

Comments
 (0)