Re: [PATCH v6 2/4] leds: Add driver for Qualcomm LPG

From: Bjorn Andersson
Date: Thu Apr 29 2021 - 16:54:43 EST


On Thu 29 Apr 14:31 CDT 2021, Marijn Suijten wrote:

> On 4/29/21 12:39 AM, Bjorn Andersson wrote:
> > On Sun 18 Apr 16:54 CDT 2021, Marijn Suijten wrote:
[..]
> > > > + ret = lpg_init_lut(lpg);
> > > > + if (ret < 0)
> > > > + return ret;
> > >
> > >
> > > How about turning these returns into dev_err_probe? I'm not sure if that's
> > > the expected way to go nowadays, but having some form of logging when a
> > > driver fails to probe is always good to have.
> > >
> >
> > The intention is that each code path through these functions will either
> > pass or spit out an error in the log. I looked through them again and
> > think I cover all paths...
>
>
> That is true, all the errors not covered are extremely unlikely like
> -ENOMEM. I vaguely recall having to insert extra logging to get through
> initial probe, but that might have been something inside lpg_add_led as
> well. Fine to leave this as it is.
>

When kzalloc et al returns -ENOMEM it will be done with an error print,
so that does not need an additional print. That said, another pass
through lpg_add_led() made me spot that if you get a parse error on
the "color" property we would silently return -EINVAL. I've corrected
this.

Thanks,
Bjorn