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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux