Since name == NULL can't ever match, move the check out of
IRQ-disabled region.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
        struct gpio_device *gdev;
        unsigned long flags;
 
+       if (!name)
+               return NULL;
+
        spin_lock_irqsave(&gpio_lock, flags);
 
        list_for_each_entry(gdev, &gpio_devices, list) {
                for (i = 0; i != gdev->ngpio; ++i) {
                        struct gpio_desc *desc = &gdev->descs[i];
 
-                       if (!desc->name || !name)
+                       if (!desc->name)
                                continue;
 
                        if (!strcmp(desc->name, name)) {