diff options
author | Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> | 2023-09-23 14:48:06 +0300 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2023-09-24 23:51:55 +0300 |
commit | 43ee22422db545800b8bf2c24ef53d040372fc7a (patch) | |
tree | 582fe7aa087ce103bf13ac0e16640c3a9bbd64c0 /drivers/power | |
parent | de1ca06bc0364a58ba0889d97a7a094d87dd5477 (diff) | |
download | linux-43ee22422db545800b8bf2c24ef53d040372fc7a.tar.xz |
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: c75f4bf6800b ("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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/mm8013.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/power/supply/mm8013.c b/drivers/power/supply/mm8013.c index ddac40ef9ae5..29fd65fe6545 100644 --- a/drivers/power/supply/mm8013.c +++ b/drivers/power/supply/mm8013.c @@ -273,8 +273,10 @@ static int mm8013_probe(struct i2c_client *client) chip->client = client; chip->regmap = devm_regmap_init_i2c(client, &mm8013_regmap_config); - if (IS_ERR(chip->regmap)) + if (IS_ERR(chip->regmap)) { + ret = PTR_ERR(chip->regmap); return dev_err_probe(dev, ret, "Couldn't initialize regmap\n"); + } ret = mm8013_checkdevice(chip); if (ret) |