From a3b97de37504944fccebad994d45342024c1bdfd Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Sun, 28 Oct 2012 08:34:59 -0700 Subject: [PATCH] --- yaml --- r: 344467 b: refs/heads/master c: 04553e925baaa815025c6fd3cdc301a794fa2c74 h: refs/heads/master i: 344465: 7f759f272fb1f1ec682f1278c4d9d8621ec6a3d0 344463: 13104e2fbce54400860d54b2afe118b680d83306 v: v3 --- [refs] | 2 +- trunk/drivers/leds/leds-gpio.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 5b0e8725abb6..3d294b8ff9fd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e8941928faf248530c0eff95462e9fee0b1cc8da +refs/heads/master: 04553e925baaa815025c6fd3cdc301a794fa2c74 diff --git a/trunk/drivers/leds/leds-gpio.c b/trunk/drivers/leds/leds-gpio.c index 0b4185315261..6a2109638fbe 100644 --- a/trunk/drivers/leds/leds-gpio.c +++ b/trunk/drivers/leds/leds-gpio.c @@ -21,6 +21,7 @@ #include #include #include +#include struct gpio_led_data { struct led_classdev cdev; @@ -174,12 +175,16 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev /* count LEDs in this device, so we know how much to allocate */ count = of_get_child_count(np); if (!count) - return NULL; + return ERR_PTR(-ENODEV); + + for_each_child_of_node(np, child) + if (of_get_gpio(child, 0) == -EPROBE_DEFER) + return ERR_PTR(-EPROBE_DEFER); priv = devm_kzalloc(&pdev->dev, sizeof_gpio_leds_priv(count), GFP_KERNEL); if (!priv) - return NULL; + return ERR_PTR(-ENOMEM); for_each_child_of_node(np, child) { struct gpio_led led = {}; @@ -214,7 +219,7 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev err: for (count = priv->num_leds - 2; count >= 0; count--) delete_gpio_led(&priv->leds[count]); - return NULL; + return ERR_PTR(-ENODEV); } static const struct of_device_id of_gpio_leds_match[] = { @@ -224,7 +229,7 @@ static const struct of_device_id of_gpio_leds_match[] = { #else /* CONFIG_OF_GPIO */ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_device *pdev) { - return NULL; + return ERR_PTR(-ENODEV); } #endif /* CONFIG_OF_GPIO */ @@ -262,8 +267,8 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) } } else { priv = gpio_leds_create_of(pdev); - if (!priv) - return -ENODEV; + if (IS_ERR(priv)) + return PTR_ERR(priv); } platform_set_drvdata(pdev, priv);