Fix undefined behaviour in several gpio_pin_setflags() routines (under
sys/arm and sys/mips), squelching the clang 3.3 warnings about this. Noticed by: tinderbox and many irate spectators Submitted by: Luiz Otavio O Souza <loos.br@gmail.com> PR: kern/177759 MFC after: 3 days
This commit is contained in:
parent
d7078f3ba0
commit
27e644a80b
@ -300,8 +300,8 @@ a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (i >= sc->sc_gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags. */
|
||||
if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together. */
|
||||
|
@ -385,8 +385,8 @@ bcm_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (bcm_gpio_pin_is_ro(sc, pin))
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags. */
|
||||
if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->sc_gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together. */
|
||||
|
@ -261,8 +261,8 @@ imx51_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (i >= sc->gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags */
|
||||
if ((flags &= sc->gpio_pins[i].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together */
|
||||
|
@ -220,8 +220,8 @@ avila_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (pin >= IXP4XX_GPIO_PINS || !(sc->sc_valid & mask))
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags */
|
||||
if ((flags &= sc->sc_pins[pin].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->sc_pins[pin].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together */
|
||||
|
@ -317,8 +317,8 @@ cambria_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (pin >= GPIO_PINS)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags */
|
||||
if ((flags &= sc->sc_pins[pin].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->sc_pins[pin].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together */
|
||||
|
@ -219,8 +219,8 @@ ar71xx_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (i >= sc->gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags */
|
||||
if ((flags &= sc->gpio_pins[i].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together */
|
||||
|
@ -219,8 +219,8 @@ octeon_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (i >= sc->gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags */
|
||||
if ((flags &= sc->gpio_pins[i].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together */
|
||||
|
@ -242,8 +242,8 @@ rt305x_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
|
||||
if (i >= sc->gpio_npins)
|
||||
return (EINVAL);
|
||||
|
||||
/* Filter out unwanted flags */
|
||||
if ((flags &= sc->gpio_pins[i].gp_caps) != flags)
|
||||
/* Check for unwanted flags. */
|
||||
if ((flags & sc->gpio_pins[i].gp_caps) != flags)
|
||||
return (EINVAL);
|
||||
|
||||
/* Can't mix input/output together */
|
||||
|
Loading…
x
Reference in New Issue
Block a user