mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Peiwei Hu <jlu.hpw@foxmail.com>
Cc: mchehab@kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: ccs: complement the return check of pm_runtime_get_if_active()
Date: Fri, 19 Nov 2021 12:56:40 +0200	[thread overview]
Message-ID: <YZeC6DVSsFTL5vg4@paasikivi.fi.intel.com> (raw)
In-Reply-To: <tencent_101DAE60627DF40AE031220023065E77EB07@qq.com>

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@foxmail.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

           reply	other threads:[~2021-11-19 10:56 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <tencent_101DAE60627DF40AE031220023065E77EB07@qq.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZeC6DVSsFTL5vg4@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=jlu.hpw@foxmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®