diff mbox series

gpio: pcie-idio-24: Fix off-by-one error in get_multiple loop

Message ID 20180420135020.23423-1-vilhelm.gray@gmail.com
State New
Headers show
Series gpio: pcie-idio-24: Fix off-by-one error in get_multiple loop | expand

Commit Message

William Breathitt Gray April 20, 2018, 1:50 p.m. UTC
The PCIe-IDIO-24 features 8 bits of TTL GPIO which may be configured for
output or input. This patch fixes an off-by-one error in the loop
conditional for the get_multiple callback so that the TTL GPIO are
handled.

Fixes: ca37081595a2 ("gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/gpio/gpio-pcie-idio-24.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij April 30, 2018, 8:48 a.m. UTC | #1
On Fri, Apr 20, 2018 at 3:50 PM, William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:

> The PCIe-IDIO-24 features 8 bits of TTL GPIO which may be configured for
> output or input. This patch fixes an off-by-one error in the loop
> conditional for the get_multiple callback so that the TTL GPIO are
> handled.
>
> Fixes: ca37081595a2 ("gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks")
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
index 835607ecf658..32bcbd9a52aa 100644
--- a/drivers/gpio/gpio-pcie-idio-24.c
+++ b/drivers/gpio/gpio-pcie-idio-24.c
@@ -217,7 +217,7 @@  static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
 	bitmap_zero(bits, chip->ngpio);
 
 	/* get bits are evaluated a gpio port register at a time */
-	for (i = 0; i < ARRAY_SIZE(ports); i++) {
+	for (i = 0; i < ARRAY_SIZE(ports) + 1; i++) {
 		/* gpio offset in bits array */
 		bits_offset = i * gpio_reg_size;