diff options
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-gpio-register.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/leds/leds-gpio-register.c b/drivers/leds/leds-gpio-register.c index fbd89344bec4..75717ba68ae0 100644 --- a/drivers/leds/leds-gpio-register.c +++ b/drivers/leds/leds-gpio-register.c | |||
@@ -28,6 +28,9 @@ struct platform_device *__init gpio_led_register_device( | |||
28 | struct platform_device *ret; | 28 | struct platform_device *ret; |
29 | struct gpio_led_platform_data _pdata = *pdata; | 29 | struct gpio_led_platform_data _pdata = *pdata; |
30 | 30 | ||
31 | if (!pdata->num_leds) | ||
32 | return ERR_PTR(-EINVAL); | ||
33 | |||
31 | _pdata.leds = kmemdup(pdata->leds, | 34 | _pdata.leds = kmemdup(pdata->leds, |
32 | pdata->num_leds * sizeof(*pdata->leds), GFP_KERNEL); | 35 | pdata->num_leds * sizeof(*pdata->leds), GFP_KERNEL); |
33 | if (!_pdata.leds) | 36 | if (!_pdata.leds) |