Skip to contentSkip to conversation

iio temperature/mlx90632: silence a static checker warning

PATCH In review Dan Carpenter 3 participants 3 messages Feb 22, 2018 – Feb 24, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio temperature/mlx90632: silence a static checker warning

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'.

drivers/iio/temperature/mlx90632.c +2 -0
index d695ab97d27f..9851311aa3fd 100644
@@ -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;
maintainer Acked-by on v1 1/1
#1 lore raw

OK, makes sense.

Quoted 23 lines · Dan Carpenter

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'.

drivers/iio/temperature/mlx90632.c +2 -0
index d695ab97d27f..9851311aa3fd 100644
@@ -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;
maintainer
#2 lore raw
Quoted 4 lines · On Thu, 22 Feb 2018 10:26:17 +0100 Crt Mori <[email protected]> wrote:

OK, makes sense.

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

Quoted 28 lines · Dan Carpenter
Quoted 15 lines

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'.

drivers/iio/temperature/mlx90632.c +0 -0
index d695ab97d27f..9851311aa3fd 100644

drivers/iio/temperature/mlx90632.c static int mlx90632_calc_ambient_dsp105(struct mlx90632_data *data, int *val) · line 513

Quoted 8 lines
drivers/iio/temperature/mlx90632.c +2 -0
@@ -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;  

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html