Skip to content

Commit

Permalink
leds: tca6507: Use of_get_child_count()
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
Axel Lin authored and Bryan Wu committed Feb 7, 2013
1 parent ad0ba85 commit ef754e8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/leds/leds-tca6507.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,10 @@ tca6507_led_dt_init(struct i2c_client *client)
struct device_node *np = client->dev.of_node, *child;
struct tca6507_platform_data *pdata;
struct led_info *tca_leds;
int count = 0;
int count;

for_each_child_of_node(np, child)
count++;
if (!count)
return ERR_PTR(-ENODEV);

if (count > NUM_LEDS)
count = of_get_child_count(np);
if (!count || count > NUM_LEDS)
return ERR_PTR(-ENODEV);

tca_leds = devm_kzalloc(&client->dev,
Expand Down

0 comments on commit ef754e8

Please sign in to comment.