Linux Power Management development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
Cc: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>,
	Sebastian Reichel <sre@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	ChiaEn Wu <chiaen_wu@richtek.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	kernel-janitors@vger.kernel.org, error27@gmail.com
Subject: Re: [PATCH] power: supply: mt6370: Fix missing error code in mt6370_chg_toggle_cfo()
Date: Thu, 7 Sep 2023 14:08:17 +0300	[thread overview]
Message-ID: <1092ffb3-0238-4dc0-baf3-344a653fca3f@kadam.mountain> (raw)
In-Reply-To: <cd6eea67-df0f-08b1-61cd-57a3b4f9cf0d@collabora.com>

On Thu, Sep 07, 2023 at 12:43:12PM +0200, AngeloGioacchino Del Regno wrote:
> Il 06/09/23 10:48, Harshit Mogalapalli ha scritto:
> > When mt6370_chg_field_get() suceeds, ret is set to zero and returning
> > zero when flash led is still in strobe mode looks incorrect.
> > 
> > Fixes: 233cb8a47d65 ("power: supply: mt6370: Add MediaTek MT6370 charger driver")
> > Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> > ---
> > This is based on static analysis with smatch, only compile tested.
> > ---
> >   drivers/power/supply/mt6370-charger.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 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().

regards,
dan carpenter


  reply	other threads:[~2023-09-07 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  8:48 [PATCH] power: supply: mt6370: Fix missing error code in mt6370_chg_toggle_cfo() Harshit Mogalapalli
2023-09-07 10:43 ` AngeloGioacchino Del Regno
2023-09-07 11:08   ` Dan Carpenter [this message]
2023-09-08  2:19     ` ChiaEn Wu
2023-09-08 10:01       ` AngeloGioacchino Del Regno
2023-09-11 20:15 ` Sebastian Reichel

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=1092ffb3-0238-4dc0-baf3-344a653fca3f@kadam.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chiaen_wu@richtek.com \
    --cc=error27@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=sre@kernel.org \
    /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