diff mbox series

spi: tegra20-slink: add missing pm_runtime_put if pm_runtime_get_sync fails

Message ID 20200602052404.81041-1-navid.emamdoost@gmail.com (mailing list archive)
State New, archived
Headers show
Series spi: tegra20-slink: add missing pm_runtime_put if pm_runtime_get_sync fails | expand

Commit Message

Navid Emamdoost June 2, 2020, 5:24 a.m. UTC
Call to pm_runtime_get_sync increments counter even in case of
failure leading to incorrect ref count.
Call pm_runtime_put if pm_runtime_get_sync fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/spi/spi-tegra20-slink.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 7f4d932dade7..9509b7cb14e4 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -756,6 +756,7 @@  static int tegra_slink_setup(struct spi_device *spi)
 	ret = pm_runtime_get_sync(tspi->dev);
 	if (ret < 0) {
 		dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
+		pm_runtime_put(tspi->dev);
 		return ret;
 	}