sensor: Fix less-than-zero comparison in bmi160 driver
This patch fixes a less-than-zero comparison of an unsigned value condition present in bmi160 driver. This issue was reported by Coverity (CID 152002, 152003). Change-Id: I703066519652ac1ecdd9ddf7e97ec7dcbe2a9e27 Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
This commit is contained in:
parent
e46d125e07
commit
5912d7abe7
1 changed files with 4 additions and 4 deletions
|
@ -225,7 +225,7 @@ static int bmi160_acc_odr_set(struct device *dev, uint16_t freq_int,
|
|||
uint16_t freq_milli)
|
||||
{
|
||||
struct bmi160_device_data *bmi160 = dev->driver_data;
|
||||
uint8_t odr = bmi160_freq_to_odr_val(freq_int, freq_milli);
|
||||
int odr = bmi160_freq_to_odr_val(freq_int, freq_milli);
|
||||
|
||||
if (odr < 0) {
|
||||
return odr;
|
||||
|
@ -242,7 +242,7 @@ static int bmi160_acc_odr_set(struct device *dev, uint16_t freq_int,
|
|||
return bmi160_reg_field_update(dev, BMI160_REG_ACC_CONF,
|
||||
BMI160_ACC_CONF_ODR_POS,
|
||||
BMI160_ACC_CONF_ODR_MASK,
|
||||
odr);
|
||||
(uint8_t) odr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -482,7 +482,7 @@ static int bmi160_acc_config(struct device *dev, enum sensor_channel chan,
|
|||
static int bmi160_gyr_odr_set(struct device *dev, uint16_t freq_int,
|
||||
uint16_t freq_milli)
|
||||
{
|
||||
uint8_t odr = bmi160_freq_to_odr_val(freq_int, freq_milli);
|
||||
int odr = bmi160_freq_to_odr_val(freq_int, freq_milli);
|
||||
|
||||
if (odr < 0) {
|
||||
return odr;
|
||||
|
@ -495,7 +495,7 @@ static int bmi160_gyr_odr_set(struct device *dev, uint16_t freq_int,
|
|||
return bmi160_reg_field_update(dev, BMI160_REG_GYR_CONF,
|
||||
BMI160_GYR_CONF_ODR_POS,
|
||||
BMI160_GYR_CONF_ODR_MASK,
|
||||
odr);
|
||||
(uint8_t) odr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue