Skip to content

Commit 90fee3d

Browse files
Haibo ChenBartosz Golaszewski
authored andcommitted
gpio: pca953x: avoid to use uninitialized value pinctrl
There is a variable pinctrl declared without initializer. And then has the case (switch operation chose the default case) to directly use this uninitialized value, this is not a safe behavior. So here initialize the pinctrl as 0 to avoid this issue. This is reported by Coverity. Fixes: 13c5d4c ("gpio: pca953x: Add support for PCAL6534") Signed-off-by: Haibo Chen <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent ba2dc1c commit 90fee3d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,9 @@ static u8 pcal6534_recalc_addr(struct pca953x_chip *chip, int reg, int off)
474474
case PCAL6524_DEBOUNCE:
475475
pinctrl = ((reg & PCAL_PINCTRL_MASK) >> 1) + 0x1c;
476476
break;
477+
default:
478+
pinctrl = 0;
479+
break;
477480
}
478481

479482
return pinctrl + addr + (off / BANK_SZ);

0 commit comments

Comments
 (0)