diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-19 08:00:00 -0700 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2012-09-19 15:05:21 +0100 |
commit | 0c0f4d2c4e01687b3edacb34ec73d45c4eccbfd5 (patch) | |
tree | 87800db201772e3719daabe9b245e3a553f229ae /drivers/hwmon | |
parent | 3bef14ff773afb2b26c05b30418a0b891563b0a9 (diff) |
hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure elements
commit 73d7c119255615a26070f9d6cdb722a166a29015 upstream.
twl4030_madc_conversion uses do_avg and type structure elements of
twl4030_madc_request. Initialize structure to avoid random operation.
Fix for: Coverity CID 200794 Uninitialized scalar variable.
Cc: Keerthy <j-keerthy@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/twl4030-madc-hwmon.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c index 0018c7dd009..1a174f0a3cd 100644 --- a/drivers/hwmon/twl4030-madc-hwmon.c +++ b/drivers/hwmon/twl4030-madc-hwmon.c @@ -44,12 +44,13 @@ static ssize_t madc_read(struct device *dev, struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct twl4030_madc_request req; + struct twl4030_madc_request req = { + .channels = 1 << attr->index, + .method = TWL4030_MADC_SW2, + .type = TWL4030_MADC_WAIT, + }; long val; - req.channels = (1 << attr->index); - req.method = TWL4030_MADC_SW2; - req.func_cb = NULL; val = twl4030_madc_conversion(&req); if (val < 0) return val; |