Skip to content

Commit 04b885d

Browse files
udivya73nashif
authored andcommitted
drivers: gpio: Fixed pin number check condition
Fixed check condition for GPIO pin number. This check is done before reading or writing value for the pin. Verified on ehl_crb. Signed-off-by: U Divya <[email protected]>
1 parent 86fa606 commit 04b885d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpio/gpio_intel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static int port_get_raw(const struct device *dev, uint32_t mask,
406406
while (mask != 0U) {
407407
pin = find_lsb_set(mask) - 1;
408408

409-
if (pin > cfg->num_pins) {
409+
if (pin >= cfg->num_pins) {
410410
break;
411411
}
412412

@@ -439,7 +439,7 @@ static int port_set_raw(const struct device *dev, uint32_t mask,
439439
while (mask != 0) {
440440
pin = find_lsb_set(mask) - 1;
441441

442-
if (pin > cfg->num_pins) {
442+
if (pin >= cfg->num_pins) {
443443
break;
444444
}
445445

0 commit comments

Comments
 (0)