]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
Remove a too strict test and instead, just filter the passed flags with the
authorloos <loos@FreeBSD.org>
Tue, 13 Dec 2016 03:36:41 +0000 (03:36 +0000)
committerloos <loos@FreeBSD.org>
Tue, 13 Dec 2016 03:36:41 +0000 (03:36 +0000)
supported capabilities.

Spotted by: yamori813@yahoo.co.jp (Hiroki Mori)
MFC after: 2 weeks

sys/dev/gpio/gpiobus.c

index 056dd3193d4ff76fad5ab52a030b0784e06a0d3a..90e447d065dd1f129303883578449d082af3e45e 100644 (file)
@@ -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);