linux/drivers/regulator
Arnd Bergmann 72291d619e regulator: s5m8767: fix get_register() error handling
commit e07ff94341 upstream.

The s5m8767_pmic_probe() function calls s5m8767_get_register() to
read data without checking the return code, which produces a compile-time
warning when that data is accessed:

drivers/regulator/s5m8767.c: In function 's5m8767_pmic_probe':
drivers/regulator/s5m8767.c:924:7: error: 'enable_reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/regulator/s5m8767.c:944:30: error: 'enable_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This changes the s5m8767_get_register() function to return a -EINVAL
not just for an invalid register number but also for an invalid
regulator number, as both would result in returning uninitialized
data. The s5m8767_pmic_probe() function is then changed accordingly
to fail on a read error, as all the other callers of s5m8767_get_register()
already do.

In practice this probably cannot happen, as we don't call
s5m8767_get_register() with invalid arguments, but the gcc
warning seems valid in principle, in terms writing safe
error checking.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9c4c60554a ("regulator: s5m8767: Convert to use regulator_[enable|disable|is_enabled]_regmap")
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-04 14:48:50 -07:00
..
88pm800.c
88pm8607.c
aat2870-regulator.c
ab3100.c
ab8500-ext.c
ab8500.c
act8865-regulator.c regulator: act8865: support output voltage by VSET2[] bits 2015-10-02 17:53:24 +01:00
ad5398.c
anatop-regulator.c Merge remote-tracking branches 'regulator/topic/act8865', 'regulator/topic/anatop', 'regulator/topic/arizona', 'regulator/topic/axp20x' and 'regulator/topic/bcm590xx' into regulator-next 2015-11-04 11:19:37 +00:00
arizona-ldo1.c regulator: arizona-ldo1: Fix handling of GPIO 0 2015-10-16 15:48:39 +01:00
arizona-micsupp.c
as3711-regulator.c
as3722-regulator.c
axp20x-regulator.c regulator: axp20x: Fix GPIO LDO enable value for AXP22x 2016-03-03 15:07:17 -08:00
bcm590xx-regulator.c
core.c regulator: core: Fix nested locking of supplies 2016-05-04 14:48:50 -07:00
da903x.c
da9052-regulator.c regulator: da9053: Update regulator for DA9053 BC silicon support 2015-10-16 15:36:01 +01:00
da9055-regulator.c
da9062-regulator.c
da9063-regulator.c regulator: da9063: Remove unneeded semicolon 2015-09-14 19:48:48 +01:00
da9210-regulator.c
da9210-regulator.h
da9211-regulator.c
da9211-regulator.h
db8500-prcmu.c
dbx500-prcmu.c
dbx500-prcmu.h
devres.c
dummy.c
dummy.h
fan53555.c
fixed-helper.c
fixed.c
gpio-regulator.c regulator: gpio: Fix module autoload for OF platform driver 2015-09-19 07:54:20 -07:00
helpers.c
hi6421-regulator.c
internal.h
isl6271a-regulator.c
isl9305.c
Kconfig regulator: mt6311: MT6311_REGULATOR needs to select REGMAP_I2C 2016-03-03 15:07:17 -08:00
lp872x.c
lp3971.c
lp3972.c
lp8755.c
lp8788-buck.c
lp8788-ldo.c
ltc3589.c
Makefile
max1586.c
max8649.c
max8660.c
max8907-regulator.c
max8925-regulator.c
max8952.c
max8973-regulator.c
max8997.c
max8998.c
max14577.c
max77686.c
max77693.c
max77802.c
mc13xxx-regulator-core.c
mc13xxx.h
mc13783-regulator.c
mc13892-regulator.c
mt6311-regulator.c
mt6311-regulator.h
mt6397-regulator.c
of_regulator.c regulator: Introduce property to flag set-load support 2015-09-17 12:14:12 +01:00
palmas-regulator.c
pbias-regulator.c Merge remote-tracking branches 'regulator/fix/anatop', 'regulator/fix/gpio', 'regulator/fix/pbias', 'regulator/fix/tpx65218' and 'regulator/fix/vexpress' into regulator-linus 2015-09-21 14:16:09 -07:00
pcap-regulator.c
pcf50633-regulator.c
pfuze100-regulator.c
pwm-regulator.c regulator: pwm: implement ->enable(), ->disable() and ->is_enabled methods 2015-09-21 14:11:18 -07:00
qcom_rpm-regulator.c
qcom_smd-regulator.c regulator: qcom-smd: Correct set_load() unit 2015-10-22 13:53:33 +01:00
qcom_spmi-regulator.c
rc5t583-regulator.c
rk808-regulator.c
rn5t618-regulator.c
rt5033-regulator.c
s2mpa01.c
s2mps11.c
s5m8767.c regulator: s5m8767: fix get_register() error handling 2016-05-04 14:48:50 -07:00
sky81452-regulator.c
stw481x-vmmc.c
ti-abb-regulator.c
tps6105x-regulator.c mfd: tps6105x: Use i2c regmap to access registers 2015-10-05 10:38:22 +01:00
tps6507x-regulator.c
tps6524x-regulator.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
tps6586x-regulator.c
tps51632-regulator.c
tps62360-regulator.c
tps65023-regulator.c regulator: tps65023: add device tree support 2015-09-21 10:13:17 -07:00
tps65090-regulator.c
tps65217-regulator.c
tps65218-regulator.c regulator: tps65218: Fix missing zero typo 2015-09-16 20:59:09 +01:00
tps65910-regulator.c
tps65912-regulator.c
tps80031-regulator.c
twl-regulator.c
userspace-consumer.c
vexpress.c regulator: vexpress: Fix module autoload for OF platform driver 2015-09-19 07:55:12 -07:00
virtual.c
wm831x-dcdc.c
wm831x-isink.c
wm831x-ldo.c
wm8350-regulator.c
wm8400-regulator.c
wm8994-regulator.c