regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe()
authorYizhuo <yzhai003@ucr.edu>
Thu, 3 Oct 2019 17:58:13 +0000 (10:58 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 4 Oct 2019 17:45:43 +0000 (18:45 +0100)
commit472b39c3d1bba0616eb0e9a8fa3ad0f56927c7d7
treee144268c2dd33bbb0b783e27f9ca46b1aac03916
parent87fd0db6d7df1cf4cc6e9b09e2155d1f324bf836
regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe()

Inside function max8907_regulator_probe(), variable val could
be uninitialized if regmap_read() fails. However, val is used
later in the if statement to decide the content written to
"pmic", which is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Link: https://lore.kernel.org/r/20191003175813.16415-1-yzhai003@ucr.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/max8907-regulator.c