All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: paresh.chaudhary@rockwellcollins.com
Cc: linux-iio@vger.kernel.org
Subject: [bug report] iio:temperature: Add MAX31856 thermocouple support
Date: Tue, 9 Apr 2019 14:59:55 +0300	[thread overview]
Message-ID: <20190409115955.GA16862@kadam> (raw)

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

             reply	other threads:[~2019-04-09 12:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 11:59 Dan Carpenter [this message]
2019-04-14 12:47 ` [bug report] iio:temperature: Add MAX31856 thermocouple support Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190409115955.GA16862@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=paresh.chaudhary@rockwellcollins.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.