Skip to contentSkip to conversation

STMicroelectronics st_sensors fixed warning messages

PATCH New Denis CIOCCA 3 participants 5 messages Feb 26, 2013 – Mar 2, 2013 IIO

lore
Share & tools
lore
#0 lore raw

Hi Jonathan,

as reported by Fengguang Wu, I send to you the patch to fix the warning messages. Thanks,

Denis

#1 lore raw

PATCH 1/1 iio:common: fixed all warning messages about uninitialized variables

---
 drivers/iio/common/st_sensors/st_sensors_core.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/iio/common/st_sensors/st_sensors_core.c +4 -5
index 0198324..bd33473 100644
@@ -62,7 +62,7 @@ st_sensors_match_odr_error:
 int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
 {
 	int err;
-	struct st_sensor_odr_avl odr_out;
+	struct st_sensor_odr_avl odr_out = {0, 0};
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
 	err = st_sensors_match_odr(sdata->sensor, odr, &odr_out);
@@ -114,7 +114,7 @@ st_sensors_match_odr_error:
 
 static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)
 {
-	int err, i;
+	int err, i = 0;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
 	err = st_sensors_match_fs(sdata->sensor, fs, &i);
@@ -139,14 +139,13 @@ st_accel_set_fullscale_error:
 
 int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable)
 {
-	bool found;
 	u8 tmp_value;
 	int err = -EINVAL;
-	struct st_sensor_odr_avl odr_out;
+	bool found = false;
+	struct st_sensor_odr_avl odr_out = {0, 0};
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
 	if (enable) {
-		found = false;
 		tmp_value = sdata->sensor->pw.value_on;
 		if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) &&
 			(sdata->sensor->odr.mask == sdata->sensor->pw.mask)) {
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Denis CIOCCA
Quoted 8 lines · Denis CIOCCA

Hi Jonathan,

as reported by Fengguang Wu, I send to you the patch to fix the warning messages. Thanks,

Denis

IIRC this is a false positive warning?

I'll take the patch either way, but if it's a false positive I'll queue it for the next cycle rather than send it on as a fix for this one.

#3 lore raw
Quoted 1 line

IIRC this is a false positive warning?

Yeah, only false positive warning.

Quoted 4 lines

I'll take the patch either way, but if it's a false positive I'll queue it for the next cycle rather than send it on as a fix for this one.

Thanks,

Denis

maintainer
#4 lore raw
Quoted 9 lines · Denis CIOCCA
Quoted 1 line

IIRC this is a false positive warning?

Yeah, only false positive warning.

Quoted 4 lines

I'll take the patch either way, but if it's a false positive I'll queue it for the next cycle rather than send it on as a fix for this one.

Thanks,

Being a contrary type (and because its early in the cycle and we have a whole load of fixes going anyway) I've applied to this to fixes-togreg rather than waiting for the next cycle ;)

Quoted 6 lines

Denis--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html