spi: spi-ti-qspi: Fix runtime PM imbalance on error

Message ID 20200521074643.21088-1-dinghao.liu@zju.edu.cn
State New
Headers show
Series
  • spi: spi-ti-qspi: Fix runtime PM imbalance on error
Related show

Commit Message

Dinghao Liu May 21, 2020, 7:46 a.m.
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/spi/spi-ti-qspi.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 366a3e5cca6b..6d24cff2693c 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -175,6 +175,7 @@  static int ti_qspi_setup(struct spi_device *spi)
 	ret = pm_runtime_get_sync(qspi->dev);
 	if (ret < 0) {
 		dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
+		pm_runtime_put_autosuspend(qspi->dev);
 		return ret;
 	}