mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 05:34:13 +08:00
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 <warthog618@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Dipen Patel <dipenp@nvidia.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
This commit is contained in:
parent
3e2d53b273
commit
160d6e4029
@ -1460,15 +1460,15 @@ static ssize_t linereq_read(struct file *file,
|
|||||||
static void linereq_free(struct linereq *lr)
|
static void linereq_free(struct linereq *lr)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool hte = false;
|
bool hte;
|
||||||
|
|
||||||
for (i = 0; i < lr->num_lines; i++) {
|
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,
|
hte = !!test_bit(FLAG_EVENT_CLOCK_HTE,
|
||||||
&lr->lines[i].desc->flags);
|
&lr->lines[i].desc->flags);
|
||||||
edge_detector_stop(&lr->lines[i], hte);
|
edge_detector_stop(&lr->lines[i], hte);
|
||||||
if (lr->lines[i].desc)
|
|
||||||
gpiod_free(lr->lines[i].desc);
|
gpiod_free(lr->lines[i].desc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
kfifo_free(&lr->events);
|
kfifo_free(&lr->events);
|
||||||
kfree(lr->label);
|
kfree(lr->label);
|
||||||
|
Loading…
Reference in New Issue
Block a user