Skip to content

Commit 43ee224

Browse files
harshimogalapallisre
authored andcommitted
power: supply: mm8013: Fix error code in mm8013_probe()
The value of ret is zero when passed to dev_error_probe(), we are passing zero to dev_err_probe() is a success which is incorrect. Fix this by getting the error code using PTR_ERR(). Fixes: c75f4bf ("power: supply: Introduce MM8013 fuel gauge driver") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202309190838.eu8WS6sz-lkp@intel.com/ Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/r/20230923114807.2829188-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent de1ca06 commit 43ee224

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/power/supply/mm8013.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ static int mm8013_probe(struct i2c_client *client)
273273
chip->client = client;
274274

275275
chip->regmap = devm_regmap_init_i2c(client, &mm8013_regmap_config);
276-
if (IS_ERR(chip->regmap))
276+
if (IS_ERR(chip->regmap)) {
277+
ret = PTR_ERR(chip->regmap);
277278
return dev_err_probe(dev, ret, "Couldn't initialize regmap\n");
279+
}
278280

279281
ret = mm8013_checkdevice(chip);
280282
if (ret)

0 commit comments

Comments
 (0)