Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 02:02:43 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310885 - stable/11/sys/dev/gpio
Message-ID:  <201612310202.uBV22h4Q020890@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Sat Dec 31 02:02:42 2016
New Revision: 310885
URL: https://svnweb.freebsd.org/changeset/base/310885

Log:
  MFC r310000:
  
  Remove a too strict test and instead, just filter the passed flags with the
  supported capabilities.
  
  Spotted by:	yamori813@yahoo.co.jp (Hiroki Mori)

Modified:
  stable/11/sys/dev/gpio/gpiobus.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/gpio/gpiobus.c
==============================================================================
--- stable/11/sys/dev/gpio/gpiobus.c	Sat Dec 31 02:00:51 2016	(r310884)
+++ stable/11/sys/dev/gpio/gpiobus.c	Sat Dec 31 02:02:42 2016	(r310885)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612310202.uBV22h4Q020890>