power: regulator: pfuze100: Fix unchecked pmic_reg_read, return value
pmic_reg_read returns a negative value if an error occurs. This commit adds a missing check after calling pmic_reg_read. Signed-off-by: Francois Berder <fberder@outlook.fr> Reviewed-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
committed by
Fabio Estevam
parent
cbd2dc2bdd
commit
1b0c1407d8
@@ -550,6 +550,8 @@ static int pfuze100_regulator_val(struct udevice *dev, int op, int *uV)
|
||||
return -EINVAL;
|
||||
}
|
||||
val = pmic_reg_read(dev->parent, desc->vsel_reg);
|
||||
if (val < 0)
|
||||
return val;
|
||||
if (desc->high_volt_mask && (val & desc->high_volt_mask)) {
|
||||
min_uV = desc->high_volt_desc->min_uV;
|
||||
uV_step = desc->high_volt_desc->uV_step;
|
||||
|
||||
Reference in New Issue
Block a user