Commit ef754e88 authored by Axel Lin's avatar Axel Lin Committed by Bryan Wu

leds: tca6507: Use of_get_child_count()

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
parent ad0ba85f
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment