linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: pcie-idio-24: Fix off-by-one error in get_multiple loop
@ 2018-04-20 13:50 William Breathitt Gray
  2018-04-30  8:48 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: William Breathitt Gray @ 2018-04-20 13:50 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, William Breathitt Gray

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(-)

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;
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: pcie-idio-24: Fix off-by-one error in get_multiple loop
  2018-04-20 13:50 [PATCH] gpio: pcie-idio-24: Fix off-by-one error in get_multiple loop William Breathitt Gray
@ 2018-04-30  8:48 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2018-04-30  8:48 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: open list:GPIO SUBSYSTEM, linux-kernel@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-30  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-20 13:50 [PATCH] gpio: pcie-idio-24: Fix off-by-one error in get_multiple loop William Breathitt Gray
2018-04-30  8:48 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).