1 From 78b75ab3f8c9dfac563b81105a1b838ec37a940e Mon Sep 17 00:00:00 2001
2 From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 Date: Sun, 13 Oct 2019 10:55:15 +0100
4 Subject: [PATCH] iio: chemical: sps30: Explicity truncate constant by masking
6 When breaking up a constant to write to two 8 bit registers
7 it isn't obvious to sparse that it was intentional.
9 CHECK drivers/iio/chemical/sps30.c
10 drivers/iio/chemical/sps30.c:120:30: warning: cast truncates bits from constant value (8004 becomes 4)
12 So in the interests of minimising noisy warnings, let us add
15 Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
16 Acked-by: Tomasz Duszynski <tduszyns@gmail.com>
18 drivers/iio/chemical/sps30.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
21 diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
22 index edbb956e81e8..acb9f8ecbb3d 100644
23 --- a/drivers/iio/chemical/sps30.c
24 +++ b/drivers/iio/chemical/sps30.c
25 @@ -117,7 +117,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
27 case SPS30_READ_AUTO_CLEANING_PERIOD:
28 buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8;
29 - buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD;
30 + buf[1] = (u8)(SPS30_AUTO_CLEANING_PERIOD & 0xff);
32 case SPS30_READ_DATA_READY_FLAG: