public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Bingbu Cao <bingbu.cao@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, linux-media@vger.kernel.org
Subject: Re: [PATCH] media: ov2740: Move pm-runtime cleanup on probe-errors to proper place
Date: Tue, 25 Mar 2025 11:02:14 +0800	[thread overview]
Message-ID: <3c7f3f45-5717-6251-cff0-ea4d65a1a18e@linux.intel.com> (raw)
In-Reply-To: <20250324130109.375068-1-hdegoede@redhat.com>

Hans,

Thank you for the patch.

Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>

On 3/24/25 9:01 PM, Hans de Goede wrote:
> When v4l2_subdev_init_finalize() fails no changes have been made to
> the runtime-pm device state yet, so the probe_error_media_entity_cleanup
> rollback path should not touch the runtime-pm device state.
> 
> Instead this should be done from the probe_error_v4l2_subdev_cleanup
> rollback path. Note the pm_runtime_xxx() calls are put above
> the v4l2_subdev_cleanup() call to have the reverse call order of probe().
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/media/i2c/ov2740.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
> index 80d151e8ae29..6cf461e3373c 100644
> --- a/drivers/media/i2c/ov2740.c
> +++ b/drivers/media/i2c/ov2740.c
> @@ -1456,12 +1456,12 @@ static int ov2740_probe(struct i2c_client *client)
>  	return 0;
>  
>  probe_error_v4l2_subdev_cleanup:
> +	pm_runtime_disable(&client->dev);
> +	pm_runtime_set_suspended(&client->dev);
>  	v4l2_subdev_cleanup(&ov2740->sd);
>  
>  probe_error_media_entity_cleanup:
>  	media_entity_cleanup(&ov2740->sd.entity);
> -	pm_runtime_disable(&client->dev);
> -	pm_runtime_set_suspended(&client->dev);
>  
>  probe_error_v4l2_ctrl_handler_free:
>  	v4l2_ctrl_handler_free(ov2740->sd.ctrl_handler);
> 

-- 
Best regards,
Bingbu Cao

  reply	other threads:[~2025-03-25  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 13:01 [PATCH] media: ov2740: Move pm-runtime cleanup on probe-errors to proper place Hans de Goede
2025-03-25  3:02 ` Bingbu Cao [this message]
2025-03-27  9:21 ` Sakari Ailus

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=3c7f3f45-5717-6251-cff0-ea4d65a1a18e@linux.intel.com \
    --to=bingbu.cao@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    /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