ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arash Golgol" <arash.golgol@gmail.com>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v2] media: sun8i-a83t-mipi-csi2: Use V4L2 subdev active state
Date: Fri, 15 May 2026 15:01:08 +0000	[thread overview]
Message-ID: <20260515150109.6EF13C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260515144335.61323-1-arash.golgol@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The active state lock is leaked in the error path of `pm_runtime_resume_and_get()` within `sun8i_a83t_mipi_csi2_s_stream()`.
--

commit 1aff86a32a5202665d5639183ff47ad585d7b58e
Author: Arash Golgol <arash.golgol@gmail.com>
Subject: media: sun8i-a83t-mipi-csi2: Use V4L2 subdev active state

This commit updates the sun8i-a83t-mipi-csi2 driver to use the V4L2 subdev
active state API. This simplifies format storage and replaces the bridge lock
with the state lock.

> diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
> index dbc51daa4fe37..743bc86bfeabe 100644
> --- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
> +++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c
[ ... ]
> @@ -215,8 +216,12 @@ static int sun8i_a83t_mipi_csi2_s_stream(struct v4l2_subdev *subdev, int on)
>  	unsigned long pixel_rate;
>  	int ret;
>  
> -	if (!source_subdev)
> -		return -ENODEV;
> +	state = v4l2_subdev_lock_and_get_active_state(subdev);
> +
> +	if (!source_subdev) {
> +		ret = -ENODEV;
> +		goto unlock;
> +	}
>  
>  	if (!on) {
>  		v4l2_subdev_call(source_subdev, video, s_stream, 0);

Does this code leak the active state lock if the subsequent runtime PM resume
fails?

Looking at the unmodified code that immediately follows this hunk in
sun8i_a83t_mipi_csi2_s_stream():

	/* Runtime PM */

	ret = pm_runtime_resume_and_get(dev);
	if (ret < 0)
		return ret;

Since the state lock is now acquired at the beginning of the function,
if pm_runtime_resume_and_get() returns a negative value, it directly returns
to the caller.

Because it bypasses the "goto unlock" path, the state lock remains acquired,
which could cause a deadlock on any subsequent attempt to access the active
state or start the stream.

Should this error path be updated to "goto unlock" so the lock is properly
released?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260515144335.61323-1-arash.golgol@gmail.com?part=1

      reply	other threads:[~2026-05-15 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 14:43 [PATCH v2] media: sun8i-a83t-mipi-csi2: Use V4L2 subdev active state Arash Golgol
2026-05-15 15:01 ` sashiko-bot [this message]

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=20260515150109.6EF13C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arash.golgol@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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