diff options
author | Yizhuo | 2019-01-03 22:59:12 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-03-05 17:58:46 +0100 |
commit | 651023ed93ab916efdfd1ced67e4b2d96601a405 (patch) | |
tree | b893cdbbb1e0a4901268856bc82e32fe6ef91d93 /sound | |
parent | ALSA: compress: prevent potential divide by zero bugs (diff) | |
download | kernel-qcow2-linux-651023ed93ab916efdfd1ced67e4b2d96601a405.tar.gz kernel-qcow2-linux-651023ed93ab916efdfd1ced67e4b2d96601a405.tar.xz kernel-qcow2-linux-651023ed93ab916efdfd1ced67e4b2d96601a405.zip |
ASoC: Variable "val" in function rt274_i2c_probe() could be uninitialized
[ Upstream commit 8c3590de0a378c2449fc1aec127cc693632458e4 ]
Inside function rt274_i2c_probe(), if regmap_read() function
returns -EINVAL, then local variable "val" leaves uninitialized
but used in if statement. This is potentially unsafe.
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rt274.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index d88e67341083..18a931c25ca5 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -1126,8 +1126,11 @@ static int rt274_i2c_probe(struct i2c_client *i2c, return ret; } - regmap_read(rt274->regmap, + ret = regmap_read(rt274->regmap, RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val); + if (ret) + return ret; + if (val != RT274_VENDOR_ID) { dev_err(&i2c->dev, "Device with ID register %#x is not rt274\n", val); |