Skip to content

Commit 32c094a

Browse files
Srinivas Neelibrgl
authored andcommitted
gpio: gpio-xilinx: Fix integer overflow
Current implementation is not able to configure more than 32 pins due to incorrect data type. So type casting with unsigned long to avoid it. Fixes: 02b3f84 ("xilinx: Switch to use bitmap APIs") Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent f63731e commit 32c094a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpio-xilinx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static inline void xgpio_set_value32(unsigned long *map, int bit, u32 v)
9999
const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5);
100100

101101
map[index] &= ~(0xFFFFFFFFul << offset);
102-
map[index] |= v << offset;
102+
map[index] |= (unsigned long)v << offset;
103103
}
104104

105105
static inline int xgpio_regoffset(struct xgpio_instance *chip, int ch)

0 commit comments

Comments
 (0)