power: supply: rt9467: Fix rt9467_run_aicl()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 15 Feb 2023 12:43:04 +0000 (13:43 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 14 Sep 2023 16:09:14 +0000 (18:09 +0200)
It is spurious to bail-out on a wait_for_completion_timeout() call that
does NOT timeout.

Reverse the logic to return -ETIMEDOUT instead, in case of tiemout.

Fixes: 6f7f70e3a8dd ("power: supply: rt9467: Add Richtek RT9467 charger driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/2ed01020fa8a135c36dbaa871095ded47d926507.1676464968.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/rt9467-charger.c

index 683adb1..fdfdc83 100644 (file)
@@ -598,8 +598,8 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data)
 
        reinit_completion(&data->aicl_done);
        ret = wait_for_completion_timeout(&data->aicl_done, msecs_to_jiffies(3500));
-       if (ret)
-               return ret;
+       if (ret == 0)
+               return -ETIMEDOUT;
 
        ret = rt9467_get_value_from_ranges(data, F_IAICR, RT9467_RANGE_IAICR, &aicr_get);
        if (ret) {