[bug report] iio:temperature: Add MAX31856 thermocouple support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Paresh Chaudhary,

The patch fb55a51310d1: "iio:temperature: Add MAX31856 thermocouple
support" from Mar 26, 2019, leads to the following static checker
warning:

	drivers/iio/temperature/max31856.c:215 max31856_read_raw()
	error: uninitialized symbol 'ret'.

drivers/iio/temperature/max31856.c
    185 static int max31856_read_raw(struct iio_dev *indio_dev,
    186 			     struct iio_chan_spec const *chan,
    187 			     int *val, int *val2, long mask)
    188 {
    189 	struct max31856_data *data = iio_priv(indio_dev);
    190 	int ret;
    191 
    192 	switch (mask) {
    193 	case IIO_CHAN_INFO_RAW:
    194 		ret = max31856_thermocouple_read(data, chan, val);
    195 		if (ret)
    196 			return ret;
    197 		return IIO_VAL_INT;
    198 	case IIO_CHAN_INFO_SCALE:
    199 		switch (chan->channel2) {
    200 		case IIO_MOD_TEMP_AMBIENT:
    201 			/* Cold junction Temp. Data resolution is 0.015625 */
    202 			*val = 15;
    203 			*val2 = 625000; /* 1000 * 0.015625 */
    204 			ret = IIO_VAL_INT_PLUS_MICRO;
    205 			break;
    206 		default:
    207 			/* Thermocouple Temp. Data resolution is 0.0078125 */
    208 			*val = 7;
    209 			*val2 = 812500; /* 1000 * 0.0078125) */
    210 			return IIO_VAL_INT_PLUS_MICRO;
    211 		}
    212 		break;

Smatch thinks mask can also IIO_CHAN_INFO_PROCESSED, IIO_CHAN_INFO_OFFSET,
and IIO_CHAN_INFO_AVERAGE_RAW.  It often gets these function pointer
calls a be merged together though.

    213 	}
    214 
--> 215 	return ret;
    216 }

regards,
dan carpenter



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux