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 06/16] media: sony-starvis2: Allow runtime control of link frequency
Date: Thu, 15 Oct 2026 16:12:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-173148@kernel.org> (raw)
In-Reply-To: <20261015-media-starvis2-v4-6-75fcdb4163f3@raspberrypi.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] media: starvis2: silent failure and incorrect error logging in control init
--

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

media: sony-starvis2: Allow runtime control of link frequency

This commit links V4L2_CID_LINK_FREQ to runtime controls, allowing the
link frequency to be configured while the sensor isn't streaming. It updates
starvis2_init_controls to handle the new link_freq allocations and refactors
the error handling path.

> diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
> --- a/drivers/media/i2c/sony-starvis2.c
> +++ b/drivers/media/i2c/sony-starvis2.c
> @@ -1224,25 +1250,26 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
[ ... ]
> -	/* LINK_FREQ is also read only */
> -	link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
> -					   V4L2_CID_LINK_FREQ,
> -					   ARRAY_SIZE(link_freqs) - 1,
> -					   __ffs(starvis2->link_freq_bitmap),
> -					   link_freqs);
> -
> -	if (link_freq)
> -		link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
> +	starvis2->link_freq =
> +		v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
> +				       V4L2_CID_LINK_FREQ,
> +				       __fls(starvis2->link_freq_bitmap),
> +				       __ffs(starvis2->link_freq_bitmap),
> +				       link_freqs);
> +	if (!starvis2->link_freq)
> +		goto err_free_handler;

[Severity: Low]
Does this bypass the error logging block? If v4l2_ctrl_new_int_menu() fails
to allocate the link_freq control, jumping directly to err_free_handler
results in a silent failure instead of printing a control init failure message.

> +
> +	v4l2_ctrl_modify_range(starvis2->link_freq,
> +			       __ffs(starvis2->link_freq_bitmap),
> +			       __fls(starvis2->link_freq_bitmap),
> +			       ~(starvis2->link_freq_bitmap),
> +			       __ffs(starvis2->link_freq_bitmap));
[ ... ]
> @@ -1285,16 +1316,20 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
>  	v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &starvis2_ctrl_ops, &props);
>  
>  	if (ctrl_hdlr->error) {
> -		ret = ctrl_hdlr->error;
>  		dev_err(&client->dev, "%s control init failed (%d)\n",
>  			__func__, ret);

[Severity: Low]
Does this print the unupdated ret variable (which is 0) rather than the
actual error code? The assignment ret = ctrl_hdlr->error was removed from
before the dev_err call and moved to the err_free_handler label at the end
of the function, leaving ret as 0 during this print.

> -		v4l2_ctrl_handler_free(ctrl_hdlr);
> -		return ret;
> +		goto err_free_handler;
>  	}
>  
>  	starvis2->sd.ctrl_handler = ctrl_hdlr;
>  
>  	return 0;
> +
> +err_free_handler:
> +	ret = ctrl_hdlr->error;
> +	v4l2_ctrl_handler_free(ctrl_hdlr);
> +
> +	return ret;
>  }

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

  reply	other threads:[~2026-10-15 16:12 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
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 [this message]
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-173148@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