[PATCH linux dev-4.10] hwmon: occ: Fix uninitialised variable warning
Eddie James
eajames at linux.vnet.ibm.com
Sat Jun 17 00:07:01 AEST 2017
On 06/16/2017 02:59 AM, Andrew Jeffery wrote:
> 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>
Thanks Andrew!
Eddie
> ---
> 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);
More information about the openbmc
mailing list