diff mbox series

spi: tegra20-sflash: call pm_runtime_put in case of pm_runtime_get failure

Message ID 20200602044049.17378-1-navid.emamdoost@gmail.com (mailing list archive)
State New, archived
Headers show
Series spi: tegra20-sflash: call pm_runtime_put in case of pm_runtime_get failure | expand

Commit Message

Navid Emamdoost June 2, 2020, 4:40 a.m. UTC
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.

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

Comments

Jon Hunter June 5, 2020, 6:10 a.m. UTC | #1
On 02/06/2020 05:40, Navid Emamdoost wrote:
> 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.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/spi/spi-tegra20-sflash.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
> index 514429379206..33c34f9c2021 100644
> --- a/drivers/spi/spi-tegra20-sflash.c
> +++ b/drivers/spi/spi-tegra20-sflash.c
> @@ -552,6 +552,7 @@ static int tegra_sflash_resume(struct device *dev)
>  
>  	ret = pm_runtime_get_sync(dev);
>  	if (ret < 0) {
> +		pm_runtime_put(dev);
>  		dev_err(dev, "pm runtime failed, e = %d\n", ret);
>  		return ret;
>  	}

There is another instance of this in this driver that needs fixing.

Jon
diff mbox series

Patch

diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index 514429379206..33c34f9c2021 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -552,6 +552,7 @@  static int tegra_sflash_resume(struct device *dev)
 
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
+		pm_runtime_put(dev);
 		dev_err(dev, "pm runtime failed, e = %d\n", ret);
 		return ret;
 	}