Skip to contentSkip to conversation

hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure elements

PATCH In review Guenter Roeck 3 participants 3 messages Sep 11, 2012 – Sep 12, 2012 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH v2 1/5 hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure elements

twl4030_madc_conversion uses do_avg and type structure elements of twl4030_madc_request. Initialize structure to avoid random operation.

---
v2: review feedback - initialize twl4030_madc_request structure in declaration.
With this change, I think this patch is a candidate for 3.6 and -stable.

 drivers/hwmon/twl4030-madc-hwmon.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/hwmon/twl4030-madc-hwmon.c +5 -4
index 0018c7d..1a174f0 100644
@@ -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;
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v2 1/5
#1 lore raw

Re: [lm-sensors] [PATCH v2 1/5] hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure eleme

Quoted 5 lines · Guenter Roeck

twl4030_madc_conversion uses do_avg and type structure elements of twl4030_madc_request. Initialize structure to avoid random operation.

Quoted 29 lines

---
v2: review feedback - initialize twl4030_madc_request structure in declaration.
With this change, I think this patch is a candidate for 3.6 and -stable.

 drivers/hwmon/twl4030-madc-hwmon.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/hwmon/twl4030-madc-hwmon.c +5 -4
index 0018c7d..1a174f0 100644
@@ -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;
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by Jean Delvare on v2 1/5
#2 lore raw

Re: [lm-sensors] [PATCH v2 1/5] hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure eleme

In reply to Guenter Roeck
Quoted 8 lines · Jean Delvare
Quoted 5 lines · Guenter Roeck

twl4030_madc_conversion uses do_avg and type structure elements of twl4030_madc_request. Initialize structure to avoid random operation.

Quoted 40 lines
Quoted 2 lines

---
v2: review feedback - initialize twl4030_madc_request structure in

declaration.

Quoted 1 line

With this change, I think this patch is a candidate for 3.6 and

-stable.

Review

Quoted 5 lines
 drivers/hwmon/twl4030-madc-hwmon.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/hwmon/twl4030-madc-hwmon.c

Quoted 11 lines

index 0018c7d..1a174f0 100644

drivers/hwmon/twl4030-madc-hwmon.c +3 -1
@@ -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,

drivers/hwmon/twl4030-madc-hwmon.c static ssize_t madc_read(struct device *dev, · line 56

Quoted 10 lines
drivers/hwmon/twl4030-madc-hwmon.c +2 -3
+             .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;

--
Jean Delvare

Signature · 2 lines
Regards and Thanks,
Keerthy

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors