src: Current code produces warnings for possible value overflows. (#6665)
As the input values are uint8_t types, any shift may result in value loss. Explicit promotion to the output type (uint32_t) keeps things safe. Have also changed the int32_t in ads1220_read_adc to uint32_t, type promotion and bit manipulation are a bit 'weird' on signed integers, so keep it as an unsigned to align with following function call parameter type. Have retained the prior explicit sign extension logic however. Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
This commit is contained in:
@@ -27,8 +27,8 @@ struct hx71x_adc {
|
||||
};
|
||||
|
||||
#define BYTES_PER_SAMPLE 4
|
||||
#define SAMPLE_ERROR_DESYNC 1 << 31
|
||||
#define SAMPLE_ERROR_READ_TOO_LONG 1 << 30
|
||||
#define SAMPLE_ERROR_DESYNC 1L << 31
|
||||
#define SAMPLE_ERROR_READ_TOO_LONG 1L << 30
|
||||
|
||||
static struct task_wake wake_hx71x;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user