Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dave Stevenson" <dave.stevenson@raspberrypi.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH v4 01/16] media: imx678: Rework into generic Starvis 2 sensor driver.
Date: Thu, 15 Oct 2026 16:15:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-173156@kernel.org> (raw)
In-Reply-To: <20261015-media-starvis2-v4-1-75fcdb4163f3@raspberrypi.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] media: dead code in starvis2_enable_streams() due to unconditional power-on writes
- [Low] media: starvis2_write_common() unconditionally sets success flag on I2C failure
--

commit 6500c5ca0127e3e5085414806a5f7d7e712bdaa6
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>

media: imx678: Rework into generic Starvis 2 sensor driver.

The register layout and programming model for multiple of the
Sony Starvis2 sensors is identical, so prepare for supporting
those by renaming all common parts of the driver to a starvis2_
prefix, and renaming the driver.

> diff --git a/drivers/media/i2c/imx678.c b/drivers/media/i2c/sony-starvis2.c
> similarity index 56%
> rename from drivers/media/i2c/imx678.c
> rename to drivers/media/i2c/sony-starvis2.c
> --- a/drivers/media/i2c/imx678.c
> +++ b/drivers/media/i2c/sony-starvis2.c

[ ... ]

> @@ -894,50 +903,55 @@ static int imx678_init_state(struct v4l2_subdev *sd,
>  	return 0;
>  }
>  
> -static int imx678_write_common(struct imx678 *imx678)
> +static int starvis2_write_common(struct starvis2 *starvis2)
>  {
>  	int ret = 0;
>  
> -	cci_multi_reg_write(imx678->cci, common_regs, ARRAY_SIZE(common_regs),
> +	cci_multi_reg_write(starvis2->cci, common_regs, ARRAY_SIZE(common_regs),
>  			    &ret);
>  
[ ... ]
> +	cci_write(starvis2->cci, STARVIS2_REG_INTERFACE_SEL,
> +		  STARVIS2_INTERFACE_2L_4L, &ret);
> +
> +	starvis2->common_regs_written = true;
> +

[Severity: Low]
Does starvis2_write_common() set the success flag even if the I2C writes fail?

cci_multi_reg_write() and cci_write() accumulate errors into ret. However,
this flag is unconditionally set to true before returning, which would falsely
indicate that the registers were successfully written even on an error.

>  	return ret;
>  }
>  

[ ... ]

> @@ -945,25 +959,34 @@ static int imx678_enable_streams(struct v4l2_subdev *sd,
>  	if (ret < 0)
>  		return ret;
>  
> +	if (!starvis2->common_regs_written) {

[Severity: Low]
Is this block unreachable dead code?

starvis2_enable_streams() begins by calling pm_runtime_resume_and_get(),
which triggers the runtime PM resume callback starvis2_power_on(). 
starvis2_power_on() unconditionally calls starvis2_write_common(),
which sets the starvis2->common_regs_written flag to true.

Therefore, when execution reaches this check, the flag will always be true,
making the body of this statement impossible to execute. Was the intention
to remove the register writes from starvis2_power_on() and defer them to
stream start?

> +		ret = starvis2_write_common(starvis2);
> +		if (ret) {
> +			dev_err(&client->dev, "%s failed to write common registers\n",
> +				__func__);
> +			goto err_rpm_put;
> +		}
> +	}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015-media-starvis2-v4-0-75fcdb4163f3@raspberrypi.com?part=1

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

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 15:57 [PATCH v4 00/16] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 01/16] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
2026-10-15 16:15   ` sashiko-bot [this message]
2026-10-15 15:57 ` [PATCH v4 02/16] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 03/16] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 04/16] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
2026-10-15 16:13   ` sashiko-bot
2026-10-15 15:57 ` [PATCH v4 05/16] media: sony-starvis2: Rework 2 lane support for higher link freqs Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 06/16] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
2026-10-15 16:12   ` sashiko-bot
2026-10-15 15:57 ` [PATCH v4 07/16] media: sony-starvis2: Correct the exposure range Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 08/16] media: sony-starvis2: Put module into standby after identify Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 09/16] media: sony-starvis2: Use pm_runtime_autosuspend Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 10/16] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
2026-10-15 20:17   ` Rob Herring
2026-10-15 15:57 ` [PATCH v4 11/16] media: sony-starvis2: Add support for IMX662 Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 12/16] media: sony-starvis2: Add support for IMX675 Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 13/16] media: sony-starvis2: Add support for IMX832 Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 14/16] media: sony-starvis2: Only update bits for window mode Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 15/16] media: sony-starvis2: Parameterise exposure min and step Dave Stevenson
2026-10-15 15:57 ` [PATCH v4 16/16] media: sony-starvis2: Add support for IMX585 Dave Stevenson

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-173156@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox