提交 ee203bbd 编写于 作者: M Michał Mirosław 提交者: Bartosz Golaszewski

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: NMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
上级 55f17e2a
......@@ -301,6 +301,9 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
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) {
......@@ -309,7 +312,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
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)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册