summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/led_pwm.c4
-rw-r--r--common/motion_sense.c1
-rw-r--r--common/spi_flash_reg.c4
3 files changed, 5 insertions, 4 deletions
diff --git a/common/led_pwm.c b/common/led_pwm.c
index 17201fb03e..3faa92cafe 100644
--- a/common/led_pwm.c
+++ b/common/led_pwm.c
@@ -56,8 +56,8 @@ void set_pwm_led_color(enum pwm_led_id id, int color)
{
struct pwm_led duty = { 0 };
- if ((id > CONFIG_LED_PWM_COUNT) || (id < 0) ||
- (color > EC_LED_COLOR_COUNT) || (color < -1))
+ if ((id >= CONFIG_LED_PWM_COUNT) || (id < 0) ||
+ (color >= EC_LED_COLOR_COUNT) || (color < -1))
return;
if (color != -1) {
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 1fe3aeb064..966c2da99e 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -1351,6 +1351,7 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
case 0:
case 1:
fifo_int_enabled = in->fifo_int_enable.enable;
+ /* fallthrough */
case EC_MOTION_SENSE_NO_VALUE:
out->fifo_int_enable.ret = fifo_int_enabled;
args->response_size = sizeof(out->fifo_int_enable);
diff --git a/common/spi_flash_reg.c b/common/spi_flash_reg.c
index 1301e19dc5..569bbd5072 100644
--- a/common/spi_flash_reg.c
+++ b/common/spi_flash_reg.c
@@ -111,7 +111,7 @@ int spi_flash_reg_to_protect(uint8_t sr1, uint8_t sr2, unsigned int *start,
>> 2;
/* Bad pointers or invalid data */
- if (!start || !len || sr1 == -1 || sr2 == -1)
+ if (!start || !len || sr1 == 0xff || sr2 == 0xff)
return EC_ERROR_INVAL;
for (i = 0; i < ARRAY_SIZE(spi_flash_protect_ranges); ++i) {
@@ -159,7 +159,7 @@ int spi_flash_protect_to_reg(unsigned int start, unsigned int len, uint8_t *sr1,
char bp = 0;
/* Bad pointers */
- if (!sr1 || !sr2 || *sr1 == -1 || *sr2 == -1)
+ if (!sr1 || !sr2)
return EC_ERROR_INVAL;
/* Invalid data */