]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
gpio: Return -ENODEV if gpio_hog_lookup_name() is empty
authorWolfgang Wallner <wolfgang.wallner@br-automation.com>
Fri, 24 Oct 2025 12:52:45 +0000 (14:52 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 6 Nov 2025 14:20:22 +0000 (08:20 -0600)
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@br-automation.com>
Reviewed-by: Heiko Schocher <hs@nabladev.com>
drivers/gpio/gpio-uclass.c

index 3d9f8b32b8d2baeb10e3c950e794fdb4fa22fbd6..7559b8dc7e20e77eda341c4c5dc572f60def2a94 100644 (file)
@@ -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