Re: [PATCH v2 06/12] software_node: Add support for fwnode_graph*() family of functions
From: Daniel Scally
Date: Fri Dec 18 2020 - 18:49:27 EST
On 18/12/2020 22:13, Daniel Scally wrote:
>>> + break;
>>> + }
>>> +
>>> + /* No more endpoints for that port, so stop passing old */
>>> + old = NULL;
>>
>> I wonder if you could drop the 'old' variable and use 'enpoint' in the
>> call to software_node_get_next_child(). You could then drop these two
>> lines.
>
> That won't work, because endpoint would at that point not be a child of
> the port we're passing, and the function relies on it being one:
>
> if (!p || list_empty(&p->children) ||
> (c && list_is_last(&c->entry, &p->children))) {
> fwnode_handle_put(child);
> return NULL;
> }
>
Wait, that's nonsense of course, because endpoint gets set to NULL when
software_node_get_next_child() finds nothing - I'll double check but
pretty sure you're right.