Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH -next] power: supply: rt9471: fix using wrong ce_gpio in rt9471_probe()
@ 2023-02-06  8:20 Yang Yingliang
  2023-02-06  8:59 ` ChiYuan Huang
  2023-02-06  9:13 ` ChiYuan Huang
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Yingliang @ 2023-02-06  8:20 UTC (permalink / raw)
  To: linux-pm; +Cc: sre, alina_yu, cy_huang, yangyingliang

Pass the correct 'ce_gpio' to IS_ERR(), and assign it to
the 'chip->ce_gpio', if devm_gpiod_get_optional() succeed.

Fixes: 4a1a5f6781d8 ("power: supply: rt9471: Add Richtek RT9471 charger driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/power/supply/rt9471.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/rt9471.c b/drivers/power/supply/rt9471.c
index 5d3cf375ad5c..de0bf484d313 100644
--- a/drivers/power/supply/rt9471.c
+++ b/drivers/power/supply/rt9471.c
@@ -851,10 +851,12 @@ static int rt9471_probe(struct i2c_client *i2c)
 
 	/* Default pull charge enable gpio to make 'CHG_EN' by SW control only */
 	ce_gpio = devm_gpiod_get_optional(dev, "charge-enable", GPIOD_OUT_HIGH);
-	if (IS_ERR(chip->ce_gpio))
+	if (IS_ERR(ce_gpio))
 		return dev_err_probe(dev, PTR_ERR(ce_gpio),
 				     "Failed to config charge enable gpio\n");
 
+	chip->ce_gpio = ce_gpio;
+
 	regmap = devm_regmap_init_i2c(i2c, &rt9471_regmap_config);
 	if (IS_ERR(regmap))
 		return dev_err_probe(dev, PTR_ERR(regmap), "Failed to init regmap\n");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-06 11:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06  8:20 [PATCH -next] power: supply: rt9471: fix using wrong ce_gpio in rt9471_probe() Yang Yingliang
2023-02-06  8:59 ` ChiYuan Huang
2023-02-06  9:13 ` ChiYuan Huang
2023-02-06 11:47   ` Yang Yingliang
2023-02-06 11:58     ` ChiYuan Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox