]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
gpiolib: remove warnning of allocations with IRQs disabled
authorZhangfei Gao <zhangfei.gao@linaro.org>
Sun, 9 Jun 2013 03:08:32 +0000 (11:08 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 20 Jun 2013 08:37:41 +0000 (10:37 +0200)
Move of_gpiochip_add outof spin_lock, since kzalloc inside
of_gpiochip_add -> of_gpiochip_add_pin_range -> gpiochip_add_pin_range -> kzalloc

WARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xf8/0xfc()
DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index c2534d62911cfd18434c9b2bb172cad265603e0d..ff0fd655729f9e22d920d4efcb20777b93469df3 100644 (file)
@@ -1214,15 +1214,14 @@ int gpiochip_add(struct gpio_chip *chip)
                }
        }
 
+       spin_unlock_irqrestore(&gpio_lock, flags);
+
 #ifdef CONFIG_PINCTRL
        INIT_LIST_HEAD(&chip->pin_ranges);
 #endif
 
        of_gpiochip_add(chip);
 
-unlock:
-       spin_unlock_irqrestore(&gpio_lock, flags);
-
        if (status)
                goto fail;
 
@@ -1235,6 +1234,9 @@ unlock:
                chip->label ? : "generic");
 
        return 0;
+
+unlock:
+       spin_unlock_irqrestore(&gpio_lock, flags);
 fail:
        /* failures here can mean systems won't boot... */
        pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n",