lkml.org 
[lkml]   [2020]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] spi: tegra114: missing put on pm_runtime_get_sync failure
From
Date

On 02/06/2020 05:55, Navid Emamdoost wrote:
> 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@gmail.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;
> }

I am wondering if it is better we use put_sync() here to ensure that
this happens before we exit the probe.

Jon

--
nvpublic

\
 
 \ /
  Last update: 2020-06-05 08:09    [W:0.037 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site