mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 08:21:14 +00:00
e64564920a
Refreshed all patches. Compile-tested on: cns3xxx Runtime-tested on: cns3xxx Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
From 78b75ab3f8c9dfac563b81105a1b838ec37a940e Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Date: Sun, 13 Oct 2019 10:55:15 +0100
|
|
Subject: [PATCH] iio: chemical: sps30: Explicity truncate constant by masking
|
|
|
|
When breaking up a constant to write to two 8 bit registers
|
|
it isn't obvious to sparse that it was intentional.
|
|
|
|
CHECK drivers/iio/chemical/sps30.c
|
|
drivers/iio/chemical/sps30.c:120:30: warning: cast truncates bits from constant value (8004 becomes 4)
|
|
|
|
So in the interests of minimising noisy warnings, let us add
|
|
a mask.
|
|
|
|
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Acked-by: Tomasz Duszynski <tduszyns@gmail.com>
|
|
---
|
|
drivers/iio/chemical/sps30.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
--- a/drivers/iio/chemical/sps30.c
|
|
+++ b/drivers/iio/chemical/sps30.c
|
|
@@ -117,7 +117,7 @@ static int sps30_do_cmd(struct sps30_sta
|
|
break;
|
|
case SPS30_READ_AUTO_CLEANING_PERIOD:
|
|
buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8;
|
|
- buf[1] = (u8)SPS30_AUTO_CLEANING_PERIOD;
|
|
+ buf[1] = (u8)(SPS30_AUTO_CLEANING_PERIOD & 0xff);
|
|
/* fall through */
|
|
case SPS30_READ_DATA_READY_FLAG:
|
|
case SPS30_READ_DATA:
|