mfd: pm8008: Fix return value check in pm8008_probe()
Subsystems (2)
PATCH 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().
--- drivers/mfd/qcom-pm8008.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/qcom-pm8008.c +1 -1
@@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)struct pm8008_data *chip; chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL ); -if (!chip) +if (IS_ERR (chip))return -ENOMEM ; chip->dev = &client->dev;
Signature · 1 line
2.25.1
Quoted 7 lines · Yang Yingliang
In case of error, the function
devm_regmap_init_i2c()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Fixes 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")Reported-by Hulk Robot <[email protected]>Signed-off-by Yang Yingliang <[email protected]>
Quoted 20 lines
--- drivers/mfd/qcom-pm8008.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/qcom-pm8008.c +1
-1@@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)struct pm8008_data *chip; chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL ); -if (!chip) +if (IS_ERR (chip))return -ENOMEM ; chip->dev = &client->dev;Signature · 1 line
2.25.1
Quoted 11 lines · Guru Das Srinagesh
Quoted 7 lines · Yang Yingliang
In case of error, the function
devm_regmap_init_i2c()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Fixes 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")Reported-by Hulk Robot <[email protected]>Signed-off-by Yang Yingliang <[email protected]>
Interestingly, the change does not correspond to the changelog message. And the code is correct as devm_kzalloc returns NULL if I remember correctly.
Quoted 21 lines
Quoted 21 lines
--- drivers/mfd/qcom-pm8008.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/qcom-pm8008.c +1
-2@@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)struct pm8008_data *chip; chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL ); -if (!chip) +if (IS_ERR (chip))return -ENOMEM ; chip->dev = &client->dev; --2.25.1
Signature · 2 lines
With best wishes Dmitry
Quoted 11 lines · Dmitry Baryshkov
Quoted 10 lines · Guru Das Srinagesh
Quoted 7 lines · Yang Yingliang
In case of error, the function
devm_regmap_init_i2c()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Fixes 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")Reported-by Hulk Robot <[email protected]>Signed-off-by Yang Yingliang <[email protected]>
Quoted 5 lines
Quoted 1 line
Interestingly, the change does not correspond to the changelog message. And the code is correct as
devm_kzallocreturns NULL if I remember correctly.
Thanks for pointing that out - I missed that. I would like to retract my Acked-by for this patch.
Quoted 28 lines
Quoted 22 lines
Quoted 22 lines
--- drivers/mfd/qcom-pm8008.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/qcom-pm8008.c +1
-2@@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)struct pm8008_data *chip; chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL ); -if (!chip) +if (IS_ERR (chip))return -ENOMEM ; chip->dev = &client->dev; --2.25.1
Signature · 2 lines
With best wishes Dmitry
Quoted 7 lines · Guru Das Srinagesh
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Guru Das Srinagesh
Quoted 4 lines · Yang Yingliang
In case of error, the function
devm_regmap_init_i2c()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Fixes 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")Reported-by Hulk Robot <[email protected]>Signed-off-by Yang Yingliang <[email protected]>Interestingly, the change does not correspond to the changelog message. And the code is correct as
devm_kzallocreturns NULL if I remember correctly.
My bad, I sent a wong patch, I will send a new one.
Thanks,
Yang
Quoted 29 lines
Thanks for pointing that out - I missed that. I would like to retract my Acked-by for this patch.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
--- drivers/mfd/qcom-pm8008.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/qcom-pm8008.c +1
-1@@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)struct pm8008_data *chip; chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL ); -if (!chip) +if (IS_ERR (chip))return -ENOMEM ;Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
drivers/mfd/qcom-pm8008.c +0
-1chip->dev = &client->dev; --2.25.1
Signature · 2 lines
With best wishes Dmitry.