]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/leds/leds-gpio-register.c
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
[karo-tx-linux.git] / drivers / leds / leds-gpio-register.c
index 1c4ed5510f356a1be0ae7782d8600198b91e6e78..75717ba68ae0b7a491995aaacef8c7b778c71aea 100644 (file)
@@ -7,9 +7,9 @@
  * Free Software Foundation.
  */
 #include <linux/err.h>
+#include <linux/leds.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-#include <linux/leds.h>
 
 /**
  * gpio_led_register_device - register a gpio-led device
@@ -28,6 +28,9 @@ struct platform_device *__init gpio_led_register_device(
        struct platform_device *ret;
        struct gpio_led_platform_data _pdata = *pdata;
 
+       if (!pdata->num_leds)
+               return ERR_PTR(-EINVAL);
+
        _pdata.leds = kmemdup(pdata->leds,
                        pdata->num_leds * sizeof(*pdata->leds), GFP_KERNEL);
        if (!_pdata.leds)