mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tarang Raval <tarang.raval@siliconsignals.io>
To: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: "sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] media: i2c: imx219: Propagate errors from control range updates
Date: Tue, 4 Nov 2025 07:04:34 +0000	[thread overview]
Message-ID: <PN3P287MB1829103774EE80B120CC9B8F8BC4A@PN3P287MB1829.INDP287.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAPY8ntDy0NmU5D6Q=v+X0nN9beGFLWHQp0jpfNYq+shGaam87g@mail.gmail.com>

Hi Dave,

> On Fri, 31 Oct 2025 at 11:49, Tarang Raval
> <tarang.raval@siliconsignals.io> wrote:
> >
> > Propagate return values from __v4l2_ctrl_modify_range() and
> > __v4l2_ctrl_s_ctrl() in imx219_set_ctrl() and imx219_set_pad_format().
> > This ensures proper error handling instead of ignoring possible
> > failures. Also return the result of imx219_set_pad_format() from
> > imx219_init_state().
> 
> It should be impossible for a number of these to fail unless someone
> has messed up in updating the driver, but it does little harm in
> returning the error code back out.
> 
> The slight hesitation would be that in imx219_set_pad_format you could
> have updated the ranges/values of one or more controls, and then fail
> leaving a partially implemented mode change. It has returned an error,
> but an application would be reasonable in thinking that the previous
> working state has been retained when it hasn't.
> As long as it would only trigger due to a driver bug rather than user
> interaction, I would *not* propose that all values have to be saved
> and have to be restored on failure. It just gets too ugly.

Thank you for the detailed feedback and insights. I completely agree with 
your assessment regarding the potential for partial updates in the 
imx219_set_pad_format() function.

As you mentioned, such failures should only occur due to a driver bug, so 
this change mainly serves as protection against that scenario. Returning 
the error codes ensures better visibility of unexpected issues and makes 
debugging easier if a regression ever occurs. 

> > Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
> 
> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

Thanks!

Best Regards,
Tarang

  reply	other threads:[~2025-11-04  7:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 11:48 [PATCH v1 0/2] media: i2c: imx219: Improve error handling and readability Tarang Raval
2025-10-31 11:48 ` [PATCH v1 1/2] media: i2c: imx219: Propagate errors from control range updates Tarang Raval
2025-11-03 18:17   ` Dave Stevenson
2025-11-04  7:04     ` Tarang Raval [this message]
2025-11-04 15:21   ` Isaac Scott
2025-10-31 11:48 ` [PATCH v1 2/2] media: i2c: imx219: Replace exposure magic value with named constant Tarang Raval
2025-10-31 15:08   ` Kieran Bingham
2025-11-03 18:19   ` 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=PN3P287MB1829103774EE80B120CC9B8F8BC4A@PN3P287MB1829.INDP287.PROD.OUTLOOK.COM \
    --to=tarang.raval@siliconsignals.io \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.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

all inboxes | Powered by JetHome®