From: Dan Carpenter Date: Thu, 10 Sep 2020 10:08:05 +0000 (+0300) Subject: thunderbolt: debugfs: Fix uninitialized return in counters_write() X-Git-Tag: v5.10.7~1419^2~26^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77e4907fa620af102f4571d4edb0dcc95b4fa083;p=platform%2Fkernel%2Flinux-rpi.git 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: 54e418106c76 ("thunderbolt: Add debugfs interface") Signed-off-by: Dan Carpenter Signed-off-by: Mika Westerberg --- diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c index fdfe6e4..3680b27 100644 --- a/drivers/thunderbolt/debugfs.c +++ b/drivers/thunderbolt/debugfs.c @@ -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);