Skip to content

Commit 65271f8

Browse files
ISCAS-Vulabbroonie
authored andcommitted
regulator: max14577: Add error check for max14577_read_reg()
The function max14577_reg_get_current_limit() calls the function max14577_read_reg(), but does not check its return value. A proper implementation can be found in max14577_get_online(). Add a error check for the max14577_read_reg() and return error code if the function fails. Fixes: b0902bb ("regulator: max14577: Add regulator driver for Maxim 14577") Cc: [email protected] # v3.14 Signed-off-by: Wentao Liang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dcd7110 commit 65271f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/regulator/max14577-regulator.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ static int max14577_reg_get_current_limit(struct regulator_dev *rdev)
4040
struct max14577 *max14577 = rdev_get_drvdata(rdev);
4141
const struct maxim_charger_current *limits =
4242
&maxim_charger_currents[max14577->dev_type];
43+
int ret;
4344

4445
if (rdev_get_id(rdev) != MAX14577_CHARGER)
4546
return -EINVAL;
4647

47-
max14577_read_reg(rmap, MAX14577_CHG_REG_CHG_CTRL4, &reg_data);
48+
ret = max14577_read_reg(rmap, MAX14577_CHG_REG_CHG_CTRL4, &reg_data);
49+
if (ret < 0)
50+
return ret;
4851

4952
if ((reg_data & CHGCTRL4_MBCICHWRCL_MASK) == 0)
5053
return limits->min;

0 commit comments

Comments
 (0)