summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorHaibo Chen <haibo.chen@nxp.com>2022-12-10 23:05:58 +0100
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2022-12-30 13:38:33 +0100
commit90fee3dd5bfc1b9f4c8c0ba6cd2a35c9d79ca4de (patch)
treed54b4b46d612db5c77dddfe0a38d38ef2e20e2e5 /drivers/gpio
parentgpiolib: Fix using uninitialized lookup-flags on ACPI platforms (diff)
downloadlinux-90fee3dd5bfc1b9f4c8c0ba6cd2a35c9d79ca4de.tar.xz
linux-90fee3dd5bfc1b9f4c8c0ba6cd2a35c9d79ca4de.zip
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: 13c5d4ce8060 ("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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-pca953x.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index a59d61cd44b2..5299e5bb76d6 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -474,6 +474,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);