[PATCH linux dev-4.10] hwmon: occ: Fix uninitialised variable warning
Andrew Jeffery
andrew at aj.id.au
Fri Jun 16 17:59:17 AEST 2017
Observed the following:
CC drivers/hwmon/occ/common.o
drivers/hwmon/occ/common.c: In function ‘occ_show_status’:
drivers/hwmon/occ/common.c:262:9: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return snprintf(buf, PAGE_SIZE - 1, "%d\n", val);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
drivers/hwmon/occ/common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index f34b40062479..d3eb6f83a42c 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -257,6 +257,8 @@ static ssize_t occ_show_status(struct device *dev,
case 6:
val = header->occ_state;
break;
+ default:
+ return -EINVAL;
}
return snprintf(buf, PAGE_SIZE - 1, "%d\n", val);
--
2.11.0
More information about the openbmc
mailing list