diff options
| author | Bence Csókás <[email protected]> | 2025-03-27 19:59:27 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2025-05-11 01:30:02 +0000 |
| commit | 8856eafcc05ecf54d6dd2b6c67804fefd276472c (patch) | |
| tree | 904ac3eef37bbeb4d90b1f0cbba0a7f17766a3b2 /drivers/spi/atmel-quadspi.c | |
| parent | PM: runtime: Add new devm functions (diff) | |
| download | kernel-8856eafcc05ecf54d6dd2b6c67804fefd276472c.tar.gz kernel-8856eafcc05ecf54d6dd2b6c67804fefd276472c.zip | |
spi: atmel-quadspi: Fix unbalanced pm_runtime by using devm_ API
Fix unbalanced PM in error path of `atmel_qspi_probe()`
by using `devm_pm_runtime_*()` functions.
Reported-by: Alexander Dahl <[email protected]>
Closes: https://lore.kernel.org/linux-spi/[email protected]/
Fixes: 5af42209a4d2 ("spi: atmel-quadspi: Add support for sama7g5 QSPI")
Signed-off-by: Bence Csókás <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'drivers/spi/atmel-quadspi.c')
| -rw-r--r-- | drivers/spi/atmel-quadspi.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 244ac0106862..e7b61dc4ce67 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -1436,22 +1436,17 @@ static int atmel_qspi_probe(struct platform_device *pdev) pm_runtime_set_autosuspend_delay(&pdev->dev, 500); pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - pm_runtime_get_noresume(&pdev->dev); + devm_pm_runtime_set_active_enabled(&pdev->dev); + devm_pm_runtime_get_noresume(&pdev->dev); err = atmel_qspi_init(aq); if (err) goto dma_release; err = spi_register_controller(ctrl); - if (err) { - pm_runtime_put_noidle(&pdev->dev); - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); - pm_runtime_dont_use_autosuspend(&pdev->dev); + if (err) goto dma_release; - } + pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); @@ -1530,10 +1525,6 @@ static void atmel_qspi_remove(struct platform_device *pdev) */ dev_warn(&pdev->dev, "Failed to resume device on remove\n"); } - - pm_runtime_disable(&pdev->dev); - pm_runtime_dont_use_autosuspend(&pdev->dev); - pm_runtime_put_noidle(&pdev->dev); } static int __maybe_unused atmel_qspi_suspend(struct device *dev) |
