aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2023-04-19 12:10:13 +0200
committerTom Rini <trini@konsulko.com>2023-04-25 15:31:28 -0400
commit0fac5c47e4b82b78740264fd4ca53cd2ab28b34e (patch)
treedbf7ecd8171ef349574d5f35a66777e0b39033ed /drivers/gpio
parentb411ba921005f8aa7978dbd1c5fee630c4af298d (diff)
gpio-uclass: fix off-by-one in gpio_request_list_by_name_nodev()
By the time we jump to the err label, count represents the number of gpios we've successfully requested. So by subtracting one, we fail to free the most recently requested. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index c8be5a4d66..712119c341 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1219,7 +1219,7 @@ int gpio_request_list_by_name_nodev(ofnode node, const char *list_name,
return count;
err:
- gpio_free_list_nodev(desc, count - 1);
+ gpio_free_list_nodev(desc, count);
return ret;
}