From 2e39ac4d9b374ab56c369074265786c1e4c1bd10 Mon Sep 17 00:00:00 2001 From: dim Date: Tue, 16 Apr 2013 16:35:48 +0000 Subject: [PATCH] MFC r249449: 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 PR: kern/177759 git-svn-id: svn://svn.freebsd.org/base/stable/9@249550 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/arm/xscale/ixp425/avila_gpio.c | 4 ++-- sys/arm/xscale/ixp425/cambria_gpio.c | 4 ++-- sys/mips/atheros/ar71xx_gpio.c | 4 ++-- sys/mips/rt305x/rt305x_gpio.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/arm/xscale/ixp425/avila_gpio.c b/sys/arm/xscale/ixp425/avila_gpio.c index c3deda9f6..b633162b6 100644 --- a/sys/arm/xscale/ixp425/avila_gpio.c +++ b/sys/arm/xscale/ixp425/avila_gpio.c @@ -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 */ diff --git a/sys/arm/xscale/ixp425/cambria_gpio.c b/sys/arm/xscale/ixp425/cambria_gpio.c index d428383a2..40d2be789 100644 --- a/sys/arm/xscale/ixp425/cambria_gpio.c +++ b/sys/arm/xscale/ixp425/cambria_gpio.c @@ -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 */ diff --git a/sys/mips/atheros/ar71xx_gpio.c b/sys/mips/atheros/ar71xx_gpio.c index 09b4d5012..9cfe7426c 100644 --- a/sys/mips/atheros/ar71xx_gpio.c +++ b/sys/mips/atheros/ar71xx_gpio.c @@ -238,8 +238,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 */ diff --git a/sys/mips/rt305x/rt305x_gpio.c b/sys/mips/rt305x/rt305x_gpio.c index a5708899b..99b3e139f 100644 --- a/sys/mips/rt305x/rt305x_gpio.c +++ b/sys/mips/rt305x/rt305x_gpio.c @@ -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 */ -- 2.45.0