提交 f2d3e34a 编写于 作者: Y Yizhuo 提交者: Xie XiuQi

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: NYizhuo <yzhai003@ucr.edu>
Signed-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5d83b590
...@@ -1126,8 +1126,11 @@ static int rt274_i2c_probe(struct i2c_client *i2c, ...@@ -1126,8 +1126,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册