public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Crt Mori <cmo@melexis.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] iio temperature/mlx90632: silence a static checker warning
Date: Thu, 22 Feb 2018 09:14:53 +0000	[thread overview]
Message-ID: <20180222091453.GC9883@mwanda> (raw)

This shouldn't affect runtime at all, but Smatch complains that we
should check if mlx90632_read_ambient_raw() otherwise we
"ambient_new_raw" can be uninitialized.

    drivers/iio/temperature/mlx90632.c:509 mlx90632_calc_ambient_dsp105()
    error: uninitialized symbol 'ambient_new_raw'.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
index d695ab97d27f..9851311aa3fd 100644
--- a/drivers/iio/temperature/mlx90632.c
+++ b/drivers/iio/temperature/mlx90632.c
@@ -506,6 +506,8 @@ static int mlx90632_calc_ambient_dsp105(struct mlx90632_data *data, int *val)
 
 	ret = mlx90632_read_ambient_raw(data->regmap, &ambient_new_raw,
 					&ambient_old_raw);
+	if (ret < 0)
+		return ret;
 	*val = mlx90632_calc_temp_ambient(ambient_new_raw, ambient_old_raw,
 					  PT, PR, PG, PO, Gb);
 	return ret;

             reply	other threads:[~2018-02-22  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22  9:14 Dan Carpenter [this message]
2018-02-22  9:26 ` [PATCH] iio temperature/mlx90632: silence a static checker warning Crt Mori
2018-02-24 13:35   ` 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=20180222091453.GC9883@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=cmo@melexis.com \
    --cc=jic23@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox