gpio: fix error path in lineevent_create

Message ID 20180416111753.4714-1-u.kleine-koenig@pengutronix.de
State New
Headers show
Series
  • gpio: fix error path in lineevent_create
Related show

Commit Message

Uwe Kleine-König April 16, 2018, 11:17 a.m.
If gpiod_request() fails the cleanup must not call gpiod_free().

Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 43aeb07343ec..ce9b238fc531 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -902,7 +902,7 @@  static int lineevent_create(struct gpio_device *gdev, void __user *ip)
 	desc = &gdev->descs[offset];
 	ret = gpiod_request(desc, le->label);
 	if (ret)
-		goto out_free_desc;
+		goto out_free_label;
 	le->desc = desc;
 	le->eflags = eflags;