提交 77e4907f 编写于 作者: D Dan Carpenter 提交者: Mika Westerberg

thunderbolt: debugfs: Fix uninitialized return in counters_write()

If the first line is in an invalid format then the "ret" value is
uninitialized.  We should return -EINVAL instead.

Fixes: 54e41810 ("thunderbolt: Add debugfs interface")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
上级 54e41810
...@@ -231,6 +231,7 @@ static ssize_t counters_write(struct file *file, const char __user *user_buf, ...@@ -231,6 +231,7 @@ static ssize_t counters_write(struct file *file, const char __user *user_buf,
char *line = buf; char *line = buf;
u32 val, offset; u32 val, offset;
ret = -EINVAL;
while (parse_line(&line, &offset, &val, 1, 4)) { while (parse_line(&line, &offset, &val, 1, 4)) {
ret = tb_port_write(port, &val, TB_CFG_COUNTERS, ret = tb_port_write(port, &val, TB_CFG_COUNTERS,
offset, 1); offset, 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册