Date: Fri, 6 Sep 2013 23:39:57 +0000 (UTC) From: Luiz Otavio O Souza <loos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255334 - in head/sys: arm/broadcom/bcm2835 mips/atheros Message-ID: <201309062339.r86NdvEw077821@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: loos Date: Fri Sep 6 23:39:56 2013 New Revision: 255334 URL: http://svnweb.freebsd.org/changeset/base/255334 Log: Fix an off-by-one bug in ar71xx_gpio and bcm2835_gpio which makes the last pin unavailable. Reported and tested by: sbruno (ar71xx) Approved by: adrian (mentor) Pointy hat to: loos Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/mips/atheros/ar71xx_gpio.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Fri Sep 6 23:14:31 2013 (r255333) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Fri Sep 6 23:39:56 2013 (r255334) @@ -729,7 +729,7 @@ bcm_gpio_attach(device_t dev) goto fail; /* Initialize the software controlled pins. */ - for (i = 0, j = 0; j < BCM_GPIO_PINS - 1; j++) { + for (i = 0, j = 0; j < BCM_GPIO_PINS; j++) { if (bcm_gpio_pin_is_ro(sc, j)) continue; snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME, Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Fri Sep 6 23:14:31 2013 (r255333) +++ head/sys/mips/atheros/ar71xx_gpio.c Fri Sep 6 23:39:56 2013 (r255334) @@ -418,7 +418,7 @@ ar71xx_gpio_attach(device_t dev) "pinon", &pinon) != 0) pinon = 0; device_printf(dev, "gpio pinmask=0x%x\n", mask); - for (i = 0, j = 0; j < maxpin; j++) { + for (i = 0, j = 0; j <= maxpin; j++) { if ((mask & (1 << j)) == 0) continue; snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309062339.r86NdvEw077821>