aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-tca6507.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-01-27 04:14:14 -0500
committerBryan Wu <cooloney@gmail.com>2013-02-06 19:00:42 -0500
commitef754e88e35f86d9704f79ac8dace8c66f367164 (patch)
tree399cea1ed91619354b608c7f68162167910e4c56 /drivers/leds/leds-tca6507.c
parentad0ba85fab7da9e634c9da4f96315c8d0b9febcb (diff)
leds: tca6507: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-tca6507.c')
-rw-r--r--drivers/leds/leds-tca6507.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index 220fc7fbf1f0..070ba0741b21 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -674,14 +674,10 @@ tca6507_led_dt_init(struct i2c_client *client)
674 struct device_node *np = client->dev.of_node, *child; 674 struct device_node *np = client->dev.of_node, *child;
675 struct tca6507_platform_data *pdata; 675 struct tca6507_platform_data *pdata;
676 struct led_info *tca_leds; 676 struct led_info *tca_leds;
677 int count = 0; 677 int count;
678 678
679 for_each_child_of_node(np, child) 679 count = of_get_child_count(np);
680 count++; 680 if (!count || count > NUM_LEDS)
681 if (!count)
682 return ERR_PTR(-ENODEV);
683
684 if (count > NUM_LEDS)
685 return ERR_PTR(-ENODEV); 681 return ERR_PTR(-ENODEV);
686 682
687 tca_leds = devm_kzalloc(&client->dev, 683 tca_leds = devm_kzalloc(&client->dev,