Skip to contentSkip to conversation

FAILED: patch "[PATCH] gpio: pca953x: Fix corruption of other gpios in set_multiple." failed to apply to 4.8-stable tree

PATCH [email protected] 1 participant 1 message Nov 21, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.8-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 53f8d322234649b4d6f1515b20c127a577efd164 Mon Sep 17 00:00:00 2001

From: Phil Reid <[email protected]>
Date: Tue, 8 Nov 2016 14:00:45 +0800
Subject: [PATCH] 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.

Fixes b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
drivers/gpio/gpio-pca953x.c +1 -0
index e422568e14ad..4a8d0fe60e0c 100644
@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
 		if (bank_mask) {
 			bank_val = bits[bank / sizeof(*bits)] >>
 				  ((bank % sizeof(*bits)) * 8);
+			bank_val &= bank_mask;
 			reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val;
 		}
 	}