iio:magnetometer:mag3110: Scale factor missing for temperature
Hello Peter Meerwald,
The patch f9279d3a8cc8: "iio:magnetometer:mag3110: Scale factor missing for temperature" from Oct 1, 2014, leads to the following
^^^^^^^^^^^
[ just the other day people were searching the internet for time
travellers from the future ].
static checker warning:
drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw() info: ignoring unreachable code.
drivers/iio/magnetometer/mag3110.c
185 case IIO_CHAN_INFO_SCALE:
186 switch (chan->type) {
187 case IIO_MAGN:
188 *val = 0;
189 *val2 = 1000;
190 return IIO_VAL_INT_PLUS_MICRO;
191 case IIO_TEMP:
192 *val = 1000;
193 return IIO_VAL_INT;
194 default:
195 return -EINVAL;
196 }
197 return IIO_VAL_INT_PLUS_MICRO;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Was -EINVAL intended here?
regards,
dan carpenter
PATCH 1/1 iio:magnetometer:mag3110: Fix unreachable code
drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw()
info: ignoring unreachable code.
drivers/iio/magnetometer/mag3110.c
185 case IIO_CHAN_INFO_SCALE:
186 switch (chan->type) {
187 case IIO_MAGN:
188 *val = 0;
189 *val2 = 1000;
190 return IIO_VAL_INT_PLUS_MICRO;
191 case IIO_TEMP:
192 *val = 1000;
193 return IIO_VAL_INT;
194 default:
195 return -EINVAL;
196 }
197 return IIO_VAL_INT_PLUS_MICRO;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^introduced by f9279d3a, mag3110: Scale factor missing
--- drivers/iio/magnetometer/mag3110.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/magnetometer/mag3110.c +0 -1
@@ -194,7 +194,6 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,default :return -EINVAL ; } -return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_SAMP_FREQ : i = data->ctrl_reg1 >>MAG3110_CTRL_DR_SHIFT ; *val = mag3110_samp_freq[i][0 ];
Signature · 1 line
1.8.3.2
Re: [PATCH] iio:magnetometer:mag3110: Fix unreachable code
Quoted 19 lines · Peter Meerwald
drivers/iio/magnetometer/mag3110.c:197mag3110_read_raw()
info: ignoring unreachable code.
drivers/iio/magnetometer/mag3110.c185 case IIO_CHAN_INFO_SCALE: 186 switch (chan->type) { 187 case IIO_MAGN: 188 *val = 0; 189 *val2 = 1000; 190 return IIO_VAL_INT_PLUS_MICRO; 191 case IIO_TEMP: 192 *val = 1000; 193 return IIO_VAL_INT; 194 default: 195 return -EINVAL; 196 } 197 return IIO_VAL_INT_PLUS_MICRO; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 4 lines
introduced by
f9279d3a, mag3110: Scale factor missingSigned-off-by Peter Meerwald <[email protected]>Reported-by Dan Carpenter <[email protected]>
Applied to the togreg branch of iio.git
Thanks,
Quoted 17 lines
--- drivers/iio/magnetometer/mag3110.c | 1 - 1 file changed, 1 deletion(-)drivers/iio/magnetometer/mag3110.c +0
-1@@ -194,7 +194,6 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,default :return -EINVAL ; } -return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_SAMP_FREQ : i = data->ctrl_reg1 >>MAG3110_CTRL_DR_SHIFT ; *val = mag3110_samp_freq[i][0 ];
Quoted 6 lines
The patch
f9279d3a8cc8: "iio:magnetometer:mag3110: Scale factor missing for temperature" from Oct 1, 2014, leads to the following^^^^^^^^^^^[ just the other day people were searching the internet for time
travellers from the future ].
this is indeed weird
Quoted 18 lines
drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw() info: ignoring unreachable code.
drivers/iio/magnetometer/mag3110.c
185 caseIIO_CHAN_INFO_SCALE:186 switch (chan->type) { 187 case IIO_MAGN: 188 *val = 0; 189 *val2 = 1000; 190 return IIO_VAL_INT_PLUS_MICRO; 191 case IIO_TEMP: 192 *val = 1000; 193 return IIO_VAL_INT; 194 default: 195 return -EINVAL; 196 } 197 return IIO_VAL_INT_PLUS_MICRO; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 1 line
Was
-EINVALintended here?
no, this is dead code as the checker indicated
thanks for reporting, sent fix to linux-iio
p.
Signature · 2 lines
Peter Meerwald +43-664-2444418 (mobile)
Jonathan Cameron
maintainerQuoted 8 lines · Peter Meerwald
Quoted 6 lines
The patch
f9279d3a8cc8: "iio:magnetometer:mag3110: Scale factor missing for temperature" from Oct 1, 2014, leads to the following^^^^^^^^^^^[ just the other day people were searching the internet for time
travellers from the future ].this is indeed weird
Quite. The interesting question is how did the date format get messed up.
Quoted 27 lines
Quoted 19 lines
drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw() info: ignoring unreachable code.
drivers/iio/magnetometer/mag3110.c185 case IIO_CHAN_INFO_SCALE: 186 switch (chan->type) { 187 case IIO_MAGN: 188 *val = 0; 189 *val2 = 1000; 190 return IIO_VAL_INT_PLUS_MICRO; 191 case IIO_TEMP: 192 *val = 1000; 193 return IIO_VAL_INT; 194 default: 195 return -EINVAL; 196 } 197 return IIO_VAL_INT_PLUS_MICRO; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Quoted 1 line
Was
-EINVALintended here?no, this is dead code as the checker indicated
thanks for reporting, sent fix to linux-iio
p.