summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorYizhuo <yzhai003@ucr.edu>2019-01-03 13:59:12 -0800
committerMark Brown <broonie@kernel.org>2019-01-04 13:49:23 +0000
commit8c3590de0a378c2449fc1aec127cc693632458e4 (patch)
treec800ec541c9d7d28ecaaa11094e07d0ed8ee31b1 /sound
parent22c7d5e7bad1fb2d8b9c611acb55a389f5d848d8 (diff)
downloadlinux-8c3590de0a378c2449fc1aec127cc693632458e4.tar.bz2
ASoC: Variable "val" in function rt274_i2c_probe() could be uninitialized
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt274.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c
index 0ef966d56bac..e2855ab9a2c6 100644
--- a/sound/soc/codecs/rt274.c
+++ b/sound/soc/codecs/rt274.c
@@ -1128,8 +1128,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);