linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Miaoqian Lin <linmq006@gmail.com>,
	Hugues Fruchet <hugues.fruchet@foss.st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] media: st-delta: Fix PM disable depth imbalance in delta_probe
Date: Mon, 7 Mar 2022 08:35:31 +0100	[thread overview]
Message-ID: <2a3b4095-7b63-4da5-d0fa-43ba86715504@xs4all.nl> (raw)
In-Reply-To: <20220301031253.6142-1-linmq006@gmail.com>

Hi Miaoqian Lin,

On 3/1/22 04:12, Miaoqian Lin wrote:
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> 
> Fixes: f386509 ("[media] st-delta: STiH4xx multi-format video decoder v4l2 driver")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> changes in v2:
> - remove unused label.
> ---
>  drivers/media/platform/sti/delta/delta-v4l2.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/sti/delta/delta-v4l2.c b/drivers/media/platform/sti/delta/delta-v4l2.c
> index c887a31ebb54..36ce0775f3f9 100644
> --- a/drivers/media/platform/sti/delta/delta-v4l2.c
> +++ b/drivers/media/platform/sti/delta/delta-v4l2.c
> @@ -1899,6 +1899,7 @@ static int delta_probe(struct platform_device *pdev)
>  err_v4l2:
>  	v4l2_device_unregister(&delta->v4l2_dev);
>  err:
> +	pm_runtime_disable(dev);

This isn't right. If the devm_kzalloc at the beginning fails, then it also jump
to this label, but at that time no pm_runtime_enable() has been called yet,
so this patch will just introduce another imbalance.

You *do* need a new label here (like you did in v1 of this patch), and update
the 'goto err;' instances after the call to pm_runtime_enable() to go to that
new label.

Regards,

	Hans

>  	return ret;
>  }
>  

  reply	other threads:[~2022-03-07  7:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 11:55 [PATCH] media: st-delta: Fix PM disable depth imbalance in delta_probe Miaoqian Lin
2022-03-01  3:12 ` [PATCH v2] " Miaoqian Lin
2022-03-07  7:35   ` Hans Verkuil [this message]
2022-03-07  8:08     ` [PATCH v3] " Miaoqian Lin
2022-03-10 16:32       ` Hugues FRUCHET - 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=2a3b4095-7b63-4da5-d0fa-43ba86715504@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=hugues.fruchet@foss.st.com \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=peter.griffin@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;
as well as URLs for NNTP newsgroup(s).