[PATCH 2/3] gpiolib: gpio_free: clear gpio's "label" field too

Antony Pavlov antonynpavlov at gmail.com
Thu Jan 9 12:58:38 EST 2014


If an error occured during gpio_request_array() then we can
get not requested gpio with nonempty garbage "label" field
value. Afterward the "gpiolib" command can try to use this
nonempty garbage value.

This patch prevents this error situation.

Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/gpio/gpiolib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index b7430b0..5f13d5f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -94,6 +94,7 @@ void gpio_free(unsigned gpio)
 
 	gi->requested = false;
 	free(gi->label);
+	gi->label = NULL;
 }
 
 /**
-- 
1.8.5.2




More information about the barebox mailing list