[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200602045506.40574-1-navid.emamdoost@gmail.com>
Date: Mon, 1 Jun 2020 23:55:06 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: Laxman Dewangan <ldewangan@...dia.com>,
Mark Brown <broonie@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
linux-spi@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: emamd001@....edu, wu000273@....edu, kjlu@....edu,
mccamant@...umn.edu, Navid Emamdoost <navid.emamdoost@...il.com>
Subject: [PATCH] spi: tegra114: missing put on pm_runtime_get_sync failure
the call to pm_runtime_get_sync increments the 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@...il.com>
---
drivers/spi/spi-tegra114.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
index 83edabdb41ad..dccd2ac1a975 100644
--- a/drivers/spi/spi-tegra114.c
+++ b/drivers/spi/spi-tegra114.c
@@ -974,6 +974,7 @@ static int tegra_spi_setup(struct spi_device *spi)
dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
if (cdata)
tegra_spi_cleanup(spi);
+ pm_runtime_put(tspi->dev);
return ret;
}
@@ -1398,6 +1399,7 @@ static int tegra_spi_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret);
+ pm_runtime_put(&pdev->dev);
goto exit_pm_disable;
}
@@ -1479,6 +1481,7 @@ static int tegra_spi_resume(struct device *dev)
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
dev_err(dev, "pm runtime failed, e = %d\n", ret);
+ pm_runtime_put(dev);
return ret;
}
tegra_spi_writel(tspi, tspi->command1_reg, SPI_COMMAND1);
--
2.17.1
Powered by blists - more mailing lists