public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio temperature/mlx90632: silence a static checker warning
@ 2018-02-22  9:14 Dan Carpenter
  2018-02-22  9:26 ` Crt Mori
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2018-02-22  9:14 UTC (permalink / raw)
  To: Crt Mori
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, kernel-janitors

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-24 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-22  9:14 [PATCH] iio temperature/mlx90632: silence a static checker warning Dan Carpenter
2018-02-22  9:26 ` Crt Mori
2018-02-24 13:35   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox