git: 256d6289a86b - main - aw_gpio: Fail when a pin cannot be mapped

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 12 Nov 2026 09:51:52 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=256d6289a86b85c22e3509627e3b23078d54a947

commit 256d6289a86b85c22e3509627e3b23078d54a947
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-09 18:39:47 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-12 09:50:24 +0000

    aw_gpio: Fail when a pin cannot be mapped
    
    aw_gpio_map_gpios() returned success without setting the pin when no
    entry of the pad table matched the bank and pin of the specifier, so
    the caller went on with whatever was in its variable.  Return EINVAL.
    
    Tested on: H6
---
 sys/arm/allwinner/aw_gpio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/arm/allwinner/aw_gpio.c b/sys/arm/allwinner/aw_gpio.c
index 4f5d676c1f56..8a223bc4fb47 100644
--- a/sys/arm/allwinner/aw_gpio.c
+++ b/sys/arm/allwinner/aw_gpio.c
@@ -972,11 +972,11 @@ aw_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells,
 		if (sc->conf->padconf->pins[i].port == gpios[0] &&
 		    sc->conf->padconf->pins[i].pin == gpios[1]) {
 			*pin = i;
-			break;
+			*flags = gpios[gcells - 1];
+			return (0);
 		}
-	*flags = gpios[gcells - 1];
 
-	return (0);
+	return (EINVAL);
 }
 
 static int