From: Masahiro Yamada Date: Thu, 11 Aug 2016 16:21:58 +0000 (+0900) Subject: gpio: refactor gpiochip_find() slightly X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=acf06ff76cb94dd98ba1fa74e63a8ee578673a83;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git gpio: refactor gpiochip_find() slightly The if...else... block after the loop can be dropped with a slight refactoring. Signed-off-by: Masahiro Yamada Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 53ff25ac66d8..deaf4d4dc68e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1363,19 +1363,15 @@ struct gpio_chip *gpiochip_find(void *data, void *data)) { struct gpio_device *gdev; - struct gpio_chip *chip; + struct gpio_chip *chip = NULL; unsigned long flags; spin_lock_irqsave(&gpio_lock, flags); list_for_each_entry(gdev, &gpio_devices, list) - if (gdev->chip && match(gdev->chip, data)) + if (gdev->chip && match(gdev->chip, data)) { + chip = gdev->chip; break; - - /* No match? */ - if (&gdev->list == &gpio_devices) - chip = NULL; - else - chip = gdev->chip; + } spin_unlock_irqrestore(&gpio_lock, flags);