Commit a9a00277 authored by Phil Reid's avatar Phil Reid Committed by Greg Kroah-Hartman

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

commit 53f8d322 upstream.

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.

Fixes: b4818afe ("gpio: pca953x: Add set_multiple to allow multiple")
Signed-off-by: default avatarPhil Reid <preid@electromag.com.au>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 88fce76c
......@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
if(bankmask) {
unsigned bankval = bits[bank / sizeof(*bits)] >>
((bank % sizeof(*bits)) * 8);
bankval &= bankmask;
reg_val[bank] = (reg_val[bank] & ~bankmask) | bankval;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment