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: 54e418106c ("thunderbolt: Add debugfs interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
Dan Carpenter 2020-09-10 13:08:05 +03:00 committed by Mika Westerberg
parent 54e418106c
commit 77e4907fa6
1 changed files with 1 additions and 0 deletions

View File

@ -231,6 +231,7 @@ static ssize_t counters_write(struct file *file, const char __user *user_buf,
char *line = buf;
u32 val, offset;
ret = -EINVAL;
while (parse_line(&line, &offset, &val, 1, 4)) {
ret = tb_port_write(port, &val, TB_CFG_COUNTERS,
offset, 1);