Need help determining if the change is warranted.

Lucas Tanure tanure at linux.com
Sat May 27 02:05:40 EDT 2023


On Sat, May 27, 2023 at 1:37 AM Alison Schofield
<alison.schofield at intel.com> wrote:
>
> This may be a resend. My first msg may be stuck in moderation,
> because I sent w a new email addr.
>
> On Mon, Mar 27, 2023 at 02:34:33PM +0300, Anton Gusev wrote:
> > In the file drivers/leds/flash/leds-lm3601x.c, function lm3601x_strobe_set,
> > the calls to regmap_update_bits aren't checked for errors.
> >
> > I am unsure whether adding the checks is warranted, since
> > lm3601x_read_faults might cover the conditions that can cause
> > regmap_update_bits to fail there. On the other hand, if this is not true,
> > then lm3601x_strobe_set can fail silently. Also, all other calls to
> > regmap_update_bit in the driver are checked or directly returned.
> > --
> > Anton Gusev
>
> Hi Anton,
>
> I don't see a patch posted for this, so I'll go ahead and respond.
>
> It seems *something* can be improved here. Either examine those ret values
> as they roll in, or stop assigning those ret values. Maybe, as you guess,
> lm3601x_read_faults() is doing the needed checks. That's something you
> could dig into further before posting the patch. Also, note the answer
> might not be the same for all 3 of those calls.
>
> Alison
>
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

It's unusual for an I2C bus would suddenly stop working, so just one
check at the beginning of the function is enough.
I would remove all ret assignments apart from the first one for every
function on that driver.



More information about the Kernelnewbies mailing list