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>] [day] [month] [year] [list]
Date:   Fri, 19 Nov 2021 12:56:40 +0200
From:   Sakari Ailus <sakari.ailus@...ux.intel.com>
To:     Peiwei Hu <jlu.hpw@...mail.com>
Cc:     mchehab@...nel.org, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: ccs: complement the return check of
 pm_runtime_get_if_active()

Hi Peiwei,

On Fri, Nov 19, 2021 at 01:34:26PM +0800, Peiwei Hu wrote:
> pm_runtime_get_if_active() can return the negative value. The
> operator ! confuses the negative one with positive situation.
> 
> Signed-off-by: Peiwei Hu <jlu.hpw@...mail.com>
> ---
>  drivers/media/i2c/ccs/ccs-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> index 5363f3bcafe3..84e810451dd4 100644
> --- a/drivers/media/i2c/ccs/ccs-core.c
> +++ b/drivers/media/i2c/ccs/ccs-core.c
> @@ -670,7 +670,7 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
>  		break;
>  	}
>  
> -	pm_status = pm_runtime_get_if_active(&client->dev, true);
> +	pm_status = pm_runtime_get_if_active(&client->dev, true) > 0;
>  	if (!pm_status)
>  		return 0;

This is intentional --- pm_runtime_get_if_active() returns an error if
runtime PM is disabled.

-- 
Regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ