mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
ALSA: aoa: onyx: always initialize register read value
[ Upstream commitf474808acb
] 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:f3d9478b2c
("[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>
This commit is contained in:
parent
572b627848
commit
92631e33d6
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue