mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 16:11:38 +00:00
leds: tca6507: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
This commit is contained in:
parent
ad0ba85fab
commit
ef754e88e3
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user