diff options
author | Phil Reid <preid@electromag.com.au> | 2016-11-08 01:00:45 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-11-08 04:29:42 -0500 |
commit | 53f8d322234649b4d6f1515b20c127a577efd164 (patch) | |
tree | a0a415504e0fae15c37a4ef7473f9ddeb9cad716 /drivers/gpio | |
parent | bc33b0ca11e3df467777a4fa7639ba488c9d4911 (diff) |
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: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index e422568e14ad..4a8d0fe60e0c 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, | |||
380 | if (bank_mask) { | 380 | if (bank_mask) { |
381 | bank_val = bits[bank / sizeof(*bits)] >> | 381 | bank_val = bits[bank / sizeof(*bits)] >> |
382 | ((bank % sizeof(*bits)) * 8); | 382 | ((bank % sizeof(*bits)) * 8); |
383 | bank_val &= bank_mask; | ||
383 | reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val; | 384 | reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val; |
384 | } | 385 | } |
385 | } | 386 | } |