mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-26 04:16:39 +00:00
gpio: pca953x: avoid to use uninitialized value pinctrl
[ Upstream commit90fee3dd5b
] 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:13c5d4ce80
("gpio: pca953x: Add support for PCAL6534") Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ee84d37a5f
commit
2892b358c8
1 changed files with 3 additions and 0 deletions
|
@ -473,6 +473,9 @@ static u8 pcal6534_recalc_addr(struct pca953x_chip *chip, int reg, int off)
|
|||
case PCAL6524_DEBOUNCE:
|
||||
pinctrl = ((reg & PCAL_PINCTRL_MASK) >> 1) + 0x1c;
|
||||
break;
|
||||
default:
|
||||
pinctrl = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return pinctrl + addr + (off / BANK_SZ);
|
||||
|
|
Loading…
Reference in a new issue