提交 90fee3dd 编写于 作者: H Haibo Chen 提交者: Bartosz Golaszewski

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: 13c5d4ce ("gpio: pca953x: Add support for PCAL6534")
Signed-off-by: NHaibo Chen <haibo.chen@nxp.com>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NBartosz Golaszewski <bartosz.golaszewski@linaro.org>
上级 ba2dc1cb
...@@ -474,6 +474,9 @@ static u8 pcal6534_recalc_addr(struct pca953x_chip *chip, int reg, int off) ...@@ -474,6 +474,9 @@ static u8 pcal6534_recalc_addr(struct pca953x_chip *chip, int reg, int off)
case PCAL6524_DEBOUNCE: case PCAL6524_DEBOUNCE:
pinctrl = ((reg & PCAL_PINCTRL_MASK) >> 1) + 0x1c; pinctrl = ((reg & PCAL_PINCTRL_MASK) >> 1) + 0x1c;
break; break;
default:
pinctrl = 0;
break;
} }
return pinctrl + addr + (off / BANK_SZ); return pinctrl + addr + (off / BANK_SZ);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册