Commit 8c3590de authored by Yizhuo's avatar Yizhuo Committed by Mark Brown

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: default avatarYizhuo <yzhai003@ucr.edu>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 22c7d5e7
...@@ -1128,8 +1128,11 @@ static int rt274_i2c_probe(struct i2c_client *i2c, ...@@ -1128,8 +1128,11 @@ static int rt274_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
regmap_read(rt274->regmap, ret = regmap_read(rt274->regmap,
RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val); RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val);
if (ret)
return ret;
if (val != RT274_VENDOR_ID) { if (val != RT274_VENDOR_ID) {
dev_err(&i2c->dev, dev_err(&i2c->dev,
"Device with ID register %#x is not rt274\n", val); "Device with ID register %#x is not rt274\n", val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment