lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 25 Apr 2021 22:57:25 +0200
From:   Sylwester Nawrocki <snawrocki@...nel.org>
To:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc:     linuxarm@...wei.com, mauro.chehab@...wei.com,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Sylwester Nawrocki <s.nawrocki@...sung.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org, linux-samsung-soc@...r.kernel.org
Subject: Re: [PATCH 57/78] media: exynos4-is: use pm_runtime_resume_and_get()

On 24.04.2021 08:45, Mauro Carvalho Chehab wrote:
> Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
> added pm_runtime_resume_and_get() in order to automatically handle
> dev->power.usage_count decrement on errors.
> 
> Use the new API, in order to cleanup the error check logic.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
> ---
>   drivers/media/platform/exynos4-is/fimc-capture.c   | 6 ++----
>   drivers/media/platform/exynos4-is/fimc-is.c        | 3 ++-
>   drivers/media/platform/exynos4-is/fimc-isp-video.c | 3 +--
>   drivers/media/platform/exynos4-is/fimc-isp.c       | 7 +++----
>   drivers/media/platform/exynos4-is/fimc-lite.c      | 5 +++--
>   drivers/media/platform/exynos4-is/fimc-m2m.c       | 2 +-
>   drivers/media/platform/exynos4-is/media-dev.c      | 8 +++-----
>   drivers/media/platform/exynos4-is/mipi-csis.c      | 5 ++---
>   8 files changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> index 13c838d3f947..0da36443173c 100644
> --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> @@ -478,11 +478,9 @@ static int fimc_capture_open(struct file *file)
>   		goto unlock;
>   
>   	set_bit(ST_CAPT_BUSY, &fimc->state);
> -	ret = pm_runtime_get_sync(&fimc->pdev->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_sync(&fimc->pdev->dev);
> +	ret = pm_runtime_resume_and_get(&fimc->pdev->dev);
> +	if (ret < 0)
>   		goto unlock;
> -	}
>   
>   	ret = v4l2_fh_open(file);
>   	if (ret) {
> diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
> index 972d9601d236..bca35866cc74 100644
> --- a/drivers/media/platform/exynos4-is/fimc-is.c
> +++ b/drivers/media/platform/exynos4-is/fimc-is.c
> @@ -828,7 +828,7 @@ static int fimc_is_probe(struct platform_device *pdev)
>   			goto err_irq;
>   	}
>   
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>   	if (ret < 0)
>   		goto err_pm;

It seems you intended to use err_suspend label here. We don't need
a new label though, instead of err_pm we can jump to err_irq when
pm_runtime_resume_and_get() fails. Note that when runtime PM is
disabled pm_runtime_resume_and_get() always returns 0.

> @@ -862,6 +862,7 @@ static int fimc_is_probe(struct platform_device *pdev)
>   	fimc_is_unregister_subdevs(is);
>   err_pm:
>   	pm_runtime_put_noidle(dev);
> +err_suspend:
>   	if (!pm_runtime_enabled(dev))
>   		fimc_is_runtime_suspend(dev);
>   err_irq:


> diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
> index 1aac167abb17..a0218237d66b 100644
> --- a/drivers/media/platform/exynos4-is/mipi-csis.c
> +++ b/drivers/media/platform/exynos4-is/mipi-csis.c
> @@ -494,7 +494,7 @@ static int s5pcsis_s_power(struct v4l2_subdev *sd, int on)
>   	struct device *dev = &state->pdev->dev;
>   
>   	if (on)
> -		return pm_runtime_get_sync(dev);
> +		return pm_runtime_resume_and_get(dev);
>   
>   	return pm_runtime_put_sync(dev);
>   }
> @@ -509,9 +509,8 @@ static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable)
>   
>   	if (enable) {
>   		s5pcsis_clear_counters(state);
> -		ret = pm_runtime_get_sync(&state->pdev->dev);
> +		ret = pm_runtime_resume_and_get(&state->pdev->dev);
>   		if (ret && ret != 1) {
> -			pm_runtime_put_noidle(&state->pdev->dev);
>   			return ret;
>   		}

Braces could be dropped as well here.

>   	}


Thanks,
Sylwester

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ