From: loos Date: Tue, 13 Dec 2016 03:36:41 +0000 (+0000) Subject: Remove a too strict test and instead, just filter the passed flags with the X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9d168758d59bedb0efa0a7c4acea1c46b10daffc;p=people%2Froyger%2Ffreebsd.git Remove a too strict test and instead, just filter the passed flags with the supported capabilities. Spotted by: yamori813@yahoo.co.jp (Hiroki Mori) MFC after: 2 weeks --- diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 056dd3193d4f..90e447d065dd 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -120,9 +120,9 @@ int gpio_check_flags(uint32_t caps, uint32_t flags) { - /* Check for unwanted flags. */ - if ((flags & caps) == 0 || (flags & caps) != flags) - return (EINVAL); + /* Filter unwanted flags. */ + flags &= caps; + /* Cannot mix input/output together. */ if (flags & GPIO_PIN_INPUT && flags & GPIO_PIN_OUTPUT) return (EINVAL);