summaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-11-15 13:25:22 +0000
committerMark Brown <broonie@kernel.org>2021-11-15 13:25:22 +0000
commit642fc4fa0487dd76b9c840e217c2269d352bed41 (patch)
treeb85c3eaf0bc3c58a9641fca213a6afe19d0ae30b /drivers/spi/spi.c
parentfa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf (diff)
parent6c53b45c71b4920b5e62f0ea8079a1da382b9434 (diff)
Merge existing fixes from spi/for-5.16 into new branch
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b23e675953e1..fdd530b150a7 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3099,12 +3099,6 @@ void spi_unregister_controller(struct spi_controller *ctlr)
device_del(&ctlr->dev);
- /* Release the last reference on the controller if its driver
- * has not yet been converted to devm_spi_alloc_master/slave().
- */
- if (!ctlr->devm_allocated)
- put_device(&ctlr->dev);
-
/* free bus id */
mutex_lock(&board_lock);
if (found == ctlr)
@@ -3113,6 +3107,12 @@ void spi_unregister_controller(struct spi_controller *ctlr)
if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
mutex_unlock(&ctlr->add_lock);
+
+ /* Release the last reference on the controller if its driver
+ * has not yet been converted to devm_spi_alloc_master/slave().
+ */
+ if (!ctlr->devm_allocated)
+ put_device(&ctlr->dev);
}
EXPORT_SYMBOL_GPL(spi_unregister_controller);