spi: cadence-qspi: Fix runtime PM imbalance in probe
PATCH 1/1 spi: cadence-qspi: Fix runtime PM imbalance in probe
The probe function incorrectly calls pm_runtime_put_autosuspend() twice in succession at the end of successful probe, dropping two runtime PM references while only one was acquired earlier with pm_runtime_get_sync(). This causes a usage count underflow:
cadence-qspi 13010000.spi: Runtime PM usage count underflow!
Remove the first redundant pm_runtime_put_autosuspend() call to balance the reference count.
Tested on StarFive VisionFive 2 v1.2A board.
--- drivers/spi/spi-cadence-quadspi.c | 1 - 1 file changed, 1 deletion(-)
drivers/spi/spi-cadence-quadspi.c +0 -1
@@ -2012,7 +2012,6 @@ static int cqspi_probe(struct platform_device *pdev) }if (!(ddata && (ddata->quirks &CQSPI_DISABLE_RUNTIME_PM ))) { -pm_runtime_put_autosuspend (dev);pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); }
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 8 lines · Ali Tariq
The probe function incorrectly calls
pm_runtime_put_autosuspend()twice in succession at the end of successful probe, dropping two runtime PM references while only one was acquired earlier withpm_runtime_get_sync(). This causes a usage count underflow:cadence-qspi 13010000.spi: Runtime PM usage count underflow!
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: cadence-qspi: Fix runtime PM imbalance in probe
commit: e1f2e77624dbc35f317efd7e092aa91f7136f3f9
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 11 lines · Ali Tariq
The probe function incorrectly calls
pm_runtime_put_autosuspend()twice in succession at the end of successful probe, dropping two runtime PM references while only one was acquired earlier withpm_runtime_get_sync(). This causes a usage count underflow:cadence-qspi 13010000.spi: Runtime PM usage count underflow!
Remove the first redundant
pm_runtime_put_autosuspend()call to balance the reference count.Tested on StarFive VisionFive 2 v1.2A board.
...
drivers/spi/spi-cadence-quadspi.c static int cqspi_probe(struct platform_device *pdev) · line 2015
Quoted 3 lines
drivers/spi/spi-cadence-quadspi.c +0
-1if (!(ddata && (ddata->quirks &CQSPI_DISABLE_RUNTIME_PM ))) { -pm_runtime_put_autosuspend (dev);pm_runtime_mark_last_busy (dev);
This one — pm_runtime_mark_last_busy() — also may be removed as it's integrated into the _put_auutosuspend().
Quoted 2 lines
drivers/spi/spi-cadence-quadspi.c +0
-0pm_runtime_put_autosuspend (dev); }
Signature · 2 lines
With Best Regards, Andy Shevchenko
Thanks for the merge. Recently, there was a patch which removed the redundant pm_runtime_mark_last_busy() call:
https://lore.kernel.org/linux-kernel/[email protected]/
The patch removes pm_runtime_mark_last_busy() from the probe function, as pm_runtime_put_autosuspend() already handles this internally.
Best Regards,
Ali
Quoted 25 lines · Andy Shevchenko
Quoted 11 lines · Ali Tariq
The probe function incorrectly calls
pm_runtime_put_autosuspend()twice in succession at the end of successful probe, dropping two runtime PM references while only one was acquired earlier withpm_runtime_get_sync(). This causes a usage count underflow:cadence-qspi 13010000.spi: Runtime PM usage count underflow!
Remove the first redundant
pm_runtime_put_autosuspend()call to balance the reference count.Tested on StarFive VisionFive 2 v1.2A board.
...
drivers/spi/spi-cadence-quadspi.c static int cqspi_probe(struct platform_device *pdev) · line 2015
Quoted 3 lines
if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {drivers/spi/spi-cadence-quadspi.c +0
-1-pm_runtime_put_autosuspend (dev);pm_runtime_mark_last_busy (dev);This one —
pm_runtime_mark_last_busy()— also may be removed as it's integrated into the_put_auutosuspend().Quoted 2 lines
pm_runtime_put_autosuspend(dev); }