From: Kent Gibson Date: Thu, 14 Jul 2022 02:03:14 +0000 (+0800) Subject: gpiolib: cdev: simplify linereq_free X-Git-Tag: v6.6.17~6894^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=160d6e402900672d4b0689a7c939be487460a1fe;p=platform%2Fkernel%2Flinux-rpi.git gpiolib: cdev: simplify linereq_free The edge detector is only ever started after the line desc has been determined, so move edge_detector_stop() inside the line desc check, and merge the two checked regions into one. Signed-off-by: Kent Gibson Reviewed-by: Andy Shevchenko Acked-by: Dipen Patel Reviewed-by: Linus Walleij Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 0c9a63b..b44526e 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1460,15 +1460,15 @@ static ssize_t linereq_read(struct file *file, static void linereq_free(struct linereq *lr) { unsigned int i; - bool hte = false; + bool hte; for (i = 0; i < lr->num_lines; i++) { - if (lr->lines[i].desc) + if (lr->lines[i].desc) { hte = !!test_bit(FLAG_EVENT_CLOCK_HTE, &lr->lines[i].desc->flags); - edge_detector_stop(&lr->lines[i], hte); - if (lr->lines[i].desc) + edge_detector_stop(&lr->lines[i], hte); gpiod_free(lr->lines[i].desc); + } } kfifo_free(&lr->events); kfree(lr->label);