mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Yongzhi Liu <lyz_cs@pku.edu.cn>
Cc: a.hajda@samsung.com, narmstrong@baylibre.com,
	robert.foss@linaro.org, jonas@kwiboo.se,
	jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drm/bridge: Add missing pm_runtime_put_sync
Date: Thu, 27 Jan 2022 03:10:09 +0200	[thread overview]
Message-ID: <YfHw8WwDpnRXO07G@pendragon.ideasonboard.com> (raw)
In-Reply-To: <1643008835-73961-1-git-send-email-lyz_cs@pku.edu.cn>

Hi Yongzhi,

Thank you for the patch.

On Sun, Jan 23, 2022 at 11:20:35PM -0800, Yongzhi Liu wrote:
> pm_runtime_get_sync() will increase the rumtime PM counter
> even when it returns an error. Thus a pairing decrement is needed
> to prevent refcount leak. Fix this by replacing this API with
> pm_runtime_resume_and_get(), which will not change the runtime
> PM counter on error. Besides, a matching decrement is needed
> on the error handling path to keep the counter balanced.
> 
> Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>

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

> ---
>  drivers/gpu/drm/bridge/nwl-dsi.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 9282e61..30aacd9 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -862,18 +862,19 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
>  	memcpy(&dsi->mode, adjusted_mode, sizeof(dsi->mode));
>  	drm_mode_debug_printmodeline(adjusted_mode);
>  
> -	pm_runtime_get_sync(dev);
> +	if (pm_runtime_resume_and_get(dev) < 0)
> +		return;
>  
>  	if (clk_prepare_enable(dsi->lcdif_clk) < 0)
> -		return;
> +		goto runtime_put;
>  	if (clk_prepare_enable(dsi->core_clk) < 0)
> -		return;
> +		goto runtime_put;
>  
>  	/* Step 1 from DSI reset-out instructions */
>  	ret = reset_control_deassert(dsi->rst_pclk);
>  	if (ret < 0) {
>  		DRM_DEV_ERROR(dev, "Failed to deassert PCLK: %d\n", ret);
> -		return;
> +		goto runtime_put;
>  	}
>  
>  	/* Step 2 from DSI reset-out instructions */
> @@ -883,13 +884,18 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
>  	ret = reset_control_deassert(dsi->rst_esc);
>  	if (ret < 0) {
>  		DRM_DEV_ERROR(dev, "Failed to deassert ESC: %d\n", ret);
> -		return;
> +		goto runtime_put;
>  	}
>  	ret = reset_control_deassert(dsi->rst_byte);
>  	if (ret < 0) {
>  		DRM_DEV_ERROR(dev, "Failed to deassert BYTE: %d\n", ret);
> -		return;
> +		goto runtime_put;
>  	}
> +
> +	return;
> +
> +runtime_put:
> +	pm_runtime_put_sync(dev);
>  }
>  
>  static void

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-01-27  1:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 15:36 [PATCH] " Yongzhi Liu
2022-01-23 20:08 ` Laurent Pinchart
2022-01-24  7:20   ` [PATCH v2] " Yongzhi Liu
2022-01-27  1:10     ` Laurent Pinchart [this message]
2022-01-31 15:33       ` Robert Foss

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=YfHw8WwDpnRXO07G@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyz_cs@pku.edu.cn \
    --cc=narmstrong@baylibre.com \
    --cc=robert.foss@linaro.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®