Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: gpio_name_to_desc: factor out !name check

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>

authored by

Michał Mirosław and committed by
Bartosz Golaszewski
ee203bbd 55f17e2a

+4 -1
+4 -1
drivers/gpio/gpiolib.c
··· 301 301 struct gpio_device *gdev; 302 302 unsigned long flags; 303 303 304 + if (!name) 305 + return NULL; 306 + 304 307 spin_lock_irqsave(&gpio_lock, flags); 305 308 306 309 list_for_each_entry(gdev, &gpio_devices, list) { ··· 312 309 for (i = 0; i != gdev->ngpio; ++i) { 313 310 struct gpio_desc *desc = &gdev->descs[i]; 314 311 315 - if (!desc->name || !name) 312 + if (!desc->name) 316 313 continue; 317 314 318 315 if (!strcmp(desc->name, name)) {