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

From: AngeloGioacchino Del Regno
Date: Fri Sep 08 2023 - 06:02:58 EST


Il 08/09/23 04:19, ChiaEn Wu ha scritto:
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@xxxxxxxxxxx>


Best regards,
ChiaEn Wu

Cool. In that case:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>