[PATCH linux dev-4.10 v2 2/5] drivers: hwmon: occ: Add new sensor versions and non-hwmon attributes
Joel Stanley
joel at jms.id.au
Fri Jun 16 15:36:39 AEST 2017
On Sat, Jun 10, 2017 at 3:31 AM, Eddie James <eajames at linux.vnet.ibm.com> wrote:
> +static ssize_t occ_show_status(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + int rc;
> + int val;
> + struct occ *occ = dev_get_drvdata(dev);
> + struct occ_poll_response_header *header;
> + struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
> +
> + rc = occ_update_response(occ);
> + if (rc)
> + return rc;
> +
> + header = (struct occ_poll_response_header *)occ->resp.data;
> +
> + switch (sattr->index) {
> + case 0:
> + val = header->status & OCC_STAT_ACTIVE;
> + break;
> + case 1:
> + val = header->ext_status & OCC_EXT_STAT_DVFS_OT;
> + break;
> + case 2:
> + val = header->ext_status & OCC_EXT_STAT_DVFS_POWER;
> + break;
> + case 3:
> + val = header->ext_status & OCC_EXT_STAT_MEM_THROTTLE;
> + break;
> + case 4:
> + val = header->ext_status & OCC_EXT_STAT_QUICK_DROP;
> + break;
> + case 5:
> + val = header->occ_state;
> + break;
> + }
> +
> + return snprintf(buf, PAGE_SIZE - 1, "%d\n", val);
drivers/hwmon/occ/common.c: In function ‘occ_show_status’:
drivers/hwmon/occ/common.c:258:9: warning: ‘val’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
return snprintf(buf, PAGE_SIZE - 1, "%d\n", val);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please fix this.
More information about the openbmc
mailing list