Skip to contentSkip to conversation

spi: spi-ti-qspi: call pm_runtime_put on pm_runtime_get failure

PATCH In review Navid Emamdoost 2 participants 2 messages Jun 2, 2020 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-ti-qspi: call pm_runtime_put on pm_runtime_get failure

The counter is incremented via pm_runtime_get even in failure case. To correct the counter call pm_runtime_put in case of failure, too.

---
 drivers/spi/spi-ti-qspi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-ti-qspi.c +1 -0
index 366a3e5cca6b..dfb811c5ef76 100644
@@ -174,6 +174,7 @@ static int ti_qspi_setup(struct spi_device *spi)
 
 	ret = pm_runtime_get_sync(qspi->dev);
 	if (ret < 0) {
+		pm_runtime_put_autosuspend(qspi->dev);
 		dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
 		return ret;
 	}
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 2 lines · Navid Emamdoost

The counter is incremented via pm_runtime_get even in failure case. To correct the counter call pm_runtime_put in case of failure, too.

Someone already sent a fix for this but in any case this isn't the correct fix - pm_runtime_put() will also undo the pm_runtime_resume() that pm_runtime_get() failed to do which is wrong. pm_runtime_idle() is what you're looking for.