提交 53f8d322 编写于 作者: P Phil Reid 提交者: Linus Walleij

gpio: pca953x: Fix corruption of other gpios in set_multiple.

gpiod_set_array_value_complex does not clear the bits field.
Therefore when the drivers set_multiple funciton is called bits outside
the mask are undefined and can be either set or not. So bank_val needs
to be masked with bank_mask before or with the reg_val cache.

Cc: stable@vger.kernel.org
Fixes: b4818afe ("gpio: pca953x: Add set_multiple to allow multiple")
Signed-off-by: NPhil Reid <preid@electromag.com.au>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 bc33b0ca
...@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, ...@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
if (bank_mask) { if (bank_mask) {
bank_val = bits[bank / sizeof(*bits)] >> bank_val = bits[bank / sizeof(*bits)] >>
((bank % sizeof(*bits)) * 8); ((bank % sizeof(*bits)) * 8);
bank_val &= bank_mask;
reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val; reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册