Skip to content

Commit af4f58c

Browse files
jhovoldgregkh
authored andcommitted
spi: pl022: fix controller deregistration
commit 994b333 upstream. Make sure to deregister the controller before releasing underlying resources like DMA during driver unbind. Fixes: b43d65f ("[ARM] 5546/1: ARM PL022 SSP/SPI driver v3") Cc: stable@vger.kernel.org # 2.6.31 Cc: Linus Walleij <linusw@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260410081757.503099-9-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cc8a904 commit af4f58c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/spi/spi-pl022.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
19571957

19581958
/* Register with the SPI framework */
19591959
amba_set_drvdata(adev, pl022);
1960-
status = devm_spi_register_controller(&adev->dev, host);
1960+
status = spi_register_controller(host);
19611961
if (status != 0) {
19621962
dev_err_probe(&adev->dev, status,
19631963
"problem registering spi host\n");
@@ -1998,6 +1998,10 @@ pl022_remove(struct amba_device *adev)
19981998
if (!pl022)
19991999
return;
20002000

2001+
spi_controller_get(pl022->host);
2002+
2003+
spi_unregister_controller(pl022->host);
2004+
20012005
/*
20022006
* undo pm_runtime_put() in probe. I assume that we're not
20032007
* accessing the primecell here.
@@ -2009,6 +2013,8 @@ pl022_remove(struct amba_device *adev)
20092013
pl022_dma_remove(pl022);
20102014

20112015
amba_release_regions(adev);
2016+
2017+
spi_controller_put(pl022->host);
20122018
}
20132019

20142020
#ifdef CONFIG_PM_SLEEP

0 commit comments

Comments
 (0)