[PATCH] gpio: Return -ENODEV if gpio_hog_lookup_name() is empty
    Wolfgang Wallner 
    wolfgang.wallner at br-automation.com
       
    Fri Oct 24 14:52:45 CEST 2025
    
    
  
If CONFIG_GPIO_HOG is not set, then gpio_hog_lookup_name() is empty,
and thus does not initialize any of its parameters. It does still
return 0 though, and so any calling function might assume that the
parameters have been initialized successfully.
Change the return value to -ENODEV in this case, as the function
would in the case when CONFIG_GPIO_HOG is set but the gpio hog
could not be found.
Signed-off-by: Wolfgang Wallner <wolfgang.wallner at br-automation.com>
---
 drivers/gpio/gpio-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 3d9f8b32b8d..7559b8dc7e2 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -378,7 +378,7 @@ U_BOOT_DRIVER(gpio_hog) = {
 #else
 int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc)
 {
-	return 0;
+	return -ENODEV;
 }
 #endif
 
-- 
2.51.1
base-commit: b10c055d4e1b5153a331a61ef82a5b01b5bb4c45
branch: us/gpio_hog
    
    
More information about the U-Boot
mailing list