All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lachlan Michael" <lachlan.michael@sony.com>, devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v4 2/2] media: i2c: Add Sony IMX908 image sensor driver
Date: Fri, 16 Oct 2026 08:11:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-174000@kernel.org> (raw)
In-Reply-To: <20261016075918.19345-3-lachlan.michael@sony.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pm: runtime PM usage counter underflow due to unhandled -EINVAL
--

commit 8e82ea0902df5655064466676b372c25f29a3de5
Author: Lachlan Michael <lachlan.michael@sony.com>

media: i2c: Add Sony IMX908 image sensor driver

The IMX908 is an 8.39 MP (3856x2176) CMOS image sensor with a MIPI CSI-2
output interface. The driver supports RAW10 and RAW12 output formats,
exposure and analogue gain controls, image flipping, blanking controls
and test pattern generation.

> diff --git a/drivers/media/i2c/imx908.c b/drivers/media/i2c/imx908.c
> new file mode 100644
> index 0000000000000..4c7e78cfdcc4f
> --- /dev/null
> +++ b/drivers/media/i2c/imx908.c
[ ... ]
> +static int imx908_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
[ ... ]
> +	/* Hardware writes only when powered; cached ctrls applied on resume */
> +	if (IS_ENABLED(CONFIG_PM) && !pm_runtime_get_if_active(imx->dev))
> +		return 0;

[Severity: High]
Does this logic correctly handle errors from pm_runtime_get_if_active()?

The pm_runtime_get_if_active() function returns 1 when the device is
active, 0 when suspended, and a negative error code (like -EINVAL) when
Runtime PM is disabled.

If it returns -EINVAL, the logical NOT operator evaluates to false. This
causes the safety check to be bypassed, allowing the driver to proceed to
execute hardware writes on a potentially unpowered device.

[ ... ]
> +	if (IS_ENABLED(CONFIG_PM))
> +		pm_runtime_put(imx->dev);

[Severity: High]
If the initial pm_runtime_get_if_active() call failed and returned -EINVAL,
does this unmatched pm_runtime_put() cause a usage counter underflow?

Since the initial get call did not increment the usage counter on failure,
executing this put drops the usage counter below its baseline, corrupting
the device's Runtime PM state.

> +
> +	return ret;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016075918.19345-1-lachlan.michael@sony.com?part=2

      reply	other threads:[~2026-10-16  8:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  7:59 [PATCH v4 0/2] Add bindings and driver for Sony IMX908 Lachlan Michael
2026-10-16  7:59 ` [PATCH v4 1/2] media: dt-bindings: imx908: Add Sony IMX908 sensor Lachlan Michael
2026-10-16  8:05   ` sashiko-bot
2026-10-16 13:48   ` Rob Herring
2026-10-16  7:59 ` [PATCH v4 2/2] media: i2c: Add Sony IMX908 image sensor driver Lachlan Michael
2026-10-16  8:11   ` 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=sashiko-outbox-174000@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lachlan.michael@sony.com \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --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 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.