All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] [media] rcar-fcp: Make sure rcar_fcp_enable() returns 0 on success
Date: Wed, 17 Aug 2016 15:55:25 +0300	[thread overview]
Message-ID: <36812690.Ma8PvjacQ5@avalon> (raw)
In-Reply-To: <1470757001-4333-1-git-send-email-geert+renesas@glider.be>

Hi Geert,

Thank you for the patch.

On Tuesday 09 Aug 2016 17:36:41 Geert Uytterhoeven wrote:
> When resuming from suspend-to-RAM on r8a7795/salvator-x:
> 
>     dpm_run_callback(): pm_genpd_resume_noirq+0x0/0x90 returns 1
>     PM: Device fe940000.fdp1 failed to resume noirq: error 1
>     dpm_run_callback(): pm_genpd_resume_noirq+0x0/0x90 returns 1
>     PM: Device fe944000.fdp1 failed to resume noirq: error 1
>     dpm_run_callback(): pm_genpd_resume_noirq+0x0/0x90 returns 1
>     PM: Device fe948000.fdp1 failed to resume noirq: error 1
> 
> According to its documentation, rcar_fcp_enable() returns 0 on success
> or a negative error code if an error occurs.  Hence
> fdp1_pm_runtime_resume() and vsp1_pm_runtime_resume() forward its return
> value to their callers.
> 
> However, rcar_fcp_enable() forwards the return value of
> pm_runtime_get_sync(), which can actually be 1 on success, leading to
> the resume failure above.
> 
> To fix this, consider only negative values returned by
> pm_runtime_get_sync() to be failures.
> 
> Fixes: 7b49235e83b2347c ("[media] v4l: Add Renesas R-Car FCP driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/media/platform/rcar-fcp.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rcar-fcp.c
> b/drivers/media/platform/rcar-fcp.c index
> 0ff6b1edf1dbf677..7e944479205d4059 100644
> --- a/drivers/media/platform/rcar-fcp.c
> +++ b/drivers/media/platform/rcar-fcp.c
> @@ -99,10 +99,16 @@ EXPORT_SYMBOL_GPL(rcar_fcp_put);
>   */
>  int rcar_fcp_enable(struct rcar_fcp_device *fcp)
>  {
> +	int error;

I was going to write that the driver uses "ret" instead of "error" for integer 
status return values, but it doesn't as there no such value stored in a 
variable at all. I will thus argue that it will use that style later, so let's 
keep the style consistent with the to-be-written code if you don't mind :-)

Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree.

>  	if (!fcp)
>  		return 0;
> 
> -	return pm_runtime_get_sync(fcp->dev);
> +	error = pm_runtime_get_sync(fcp->dev);
> +	if (error < 0)
> +		return error;
> +
> +	return 0;
>  }
>  EXPORT_SYMBOL_GPL(rcar_fcp_enable);

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2016-08-17 12:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 15:36 [PATCH] [media] rcar-fcp: Make sure rcar_fcp_enable() returns 0 on success Geert Uytterhoeven
2016-08-17 12:55 ` Laurent Pinchart [this message]
2016-08-23 13:11   ` Geert Uytterhoeven
2016-09-05  8:17     ` Laurent Pinchart
2016-09-05  8:20       ` Geert Uytterhoeven
2016-09-05  8:25         ` Laurent Pinchart
2016-09-05  8:49           ` Geert Uytterhoeven

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=36812690.Ma8PvjacQ5@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.