[PATCH] power: supply: mt6370: Fix missing error code in mt6370_chg_toggle_cfo()

ChiaEn Wu chiaen_wu at richtek.com
Thu Sep 7 19:19:13 PDT 2023


On Thu, Sep 07, 2023 at 02:08:17PM +0300, Dan Carpenter wrote:

[...]

> > > diff --git a/drivers/power/supply/mt6370-charger.c b/drivers/power/supply/mt6370-charger.c
> > > index f27dae5043f5..a9641bd3d8cf 100644
> > > --- a/drivers/power/supply/mt6370-charger.c
> > > +++ b/drivers/power/supply/mt6370-charger.c
> > > @@ -324,7 +324,7 @@ static int mt6370_chg_toggle_cfo(struct mt6370_priv *priv)
> > >   	if (fl_strobe) {
> > >   		dev_err(priv->dev, "Flash led is still in strobe mode\n");
> > > -		return ret;
> > > +		return -EINVAL;
> > 
> > I think that returning 0 here was intentional, but I agree on a return ret
> > here being both confusing and wrong.
> 
> If it's a success path then probably we should remove the dev_err().
> 

Hi all,
Sorry for the late reply!

I agree with the first half of Angelo's statement, I did make the
mistake on this 'return ret'.
What I was trying to say is that you should not to toggle cfo function
when the FLED of MT6370 is still in "strobe mode".

Therefore, I think the change of Harshit's patch is correct.
It should be 'return -EINVAL' or 'return -EPERM' here.

Thanks!


Reviewed-by: ChiaEn Wu <chiaen_wu at richtek.com>


Best regards,
ChiaEn Wu



More information about the Linux-mediatek mailing list