mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
[ Upstream commit 1252b28314
]
In function pfuze100_regulator_probe(), variable "val" could be
initialized if regmap_read() fails. However, "val" is used to
decide the control flow later in the if statement, which is
potentially unsafe.
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Link: https://lore.kernel.org/r/20190929170957.14775-1-yzhai003@ucr.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e4c7179c04
commit
07d819d64a
1 changed files with 7 additions and 1 deletions
|
@ -608,7 +608,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
|
|||
|
||||
/* SW2~SW4 high bit check and modify the voltage value table */
|
||||
if (i >= sw_check_start && i <= sw_check_end) {
|
||||
regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val);
|
||||
ret = regmap_read(pfuze_chip->regmap,
|
||||
desc->vsel_reg, &val);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "Fails to read from the register.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (val & sw_hi) {
|
||||
if (pfuze_chip->chip_id == PFUZE3000) {
|
||||
desc->volt_table = pfuze3000_sw2hi;
|
||||
|
|
Loading…
Reference in a new issue