summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2019-07-29 09:14:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-29 10:24:29 +0100
commitb18c3ca2cbf3028a4c7386f81dfcb08cabb9acda (patch)
tree113987bd2f629d5e7e10c136d8b72eb8152d2bb7 /sound
parent7e820c2d27ec91e4b1029b08d1470e39989fb82c (diff)
ALSA: aoa: onyx: always initialize register read value
[ Upstream commit f474808acb3c4b30552d9c59b181244e0300d218 ] A lot of places in the driver use onyx_read_register() without checking the return value, and it's been working OK for ~10 years or so, so probably never fails ... Rather than trying to check the return value everywhere, which would be relatively intrusive, at least make sure we don't use an uninitialized value. Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/codecs/onyx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index a04edff8b729..ae50d59fb810 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -74,8 +74,10 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value)
return 0;
}
v = i2c_smbus_read_byte_data(onyx->i2c, reg);
- if (v < 0)
+ if (v < 0) {
+ *value = 0;
return -1;
+ }
*value = (u8)v;
onyx->cache[ONYX_REG_CONTROL-FIRSTREGISTER] = *value;
return 0;