Skip to contentSkip to conversation

mfd: pm8008: Fix return value check in pm8008_probe()

PATCH RESEND Applied Yang Yingliang 2 participants 2 messages Nov 25, 2022 – Dec 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 mfd: pm8008: Fix return value check in pm8008_probe()

In case of error, the function devm_regmap_init_i2c() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/

---
 drivers/mfd/qcom-pm8008.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/qcom-pm8008.c +2 -2
index 4b8ff947762f..9f3c4a01b4c1 100644
@@ -215,8 +215,8 @@ static int pm8008_probe(struct i2c_client *client)
 
 	dev = &client->dev;
 	regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg);
-	if (!regmap)
-		return -ENODEV;
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
 
 	i2c_set_clientdata(client, regmap);
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 8 lines · Yang Yingliang

In case of error, the function devm_regmap_init_i2c() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
Quoted 6 lines

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/

---
 drivers/mfd/qcom-pm8008.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Signature · 1 line
Lee Jones [李琼斯]