소스 검색

Blackfin: portmux: fix peripheral map overflow when requesting pins

Some processors have groups of pins that aren't an even number of 16.
This causes the array size calculation to under count the number of
needed entries due to integer truncation.  So on the BF51x, while we
should have 3 bitmaps (41 / 16), we end up with 2 and pin requests for
the 3rd bank end up scribbling over the top of the GPIO IRQ array.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Michael Hennerich 15 년 전
부모
커밋
382dbe5b39
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      arch/blackfin/kernel/bfin_gpio.c

+ 1 - 1
arch/blackfin/kernel/bfin_gpio.c

@@ -157,7 +157,7 @@ static int cmp_label(unsigned short ident, const char *label)
 #define DECLARE_RESERVED_MAP(m, c) static unsigned short reserved_##m##_map[c]
 
 DECLARE_RESERVED_MAP(gpio, GPIO_BANK_NUM);
-DECLARE_RESERVED_MAP(peri, gpio_bank(MAX_RESOURCES));
+DECLARE_RESERVED_MAP(peri, DIV_ROUND_UP(MAX_RESOURCES, GPIO_BANKSIZE));
 DECLARE_RESERVED_MAP(gpio_irq, GPIO_BANK_NUM);
 
 inline int check_gpio(unsigned gpio)