Re: [PATCH v2 05/12] software_node: unregister software_nodes in reverse order

From: Daniel Scally
Date: Wed Dec 23 2020 - 17:24:51 EST


On 21/12/2020 11:26, Andy Shevchenko wrote:
> On Mon, Dec 21, 2020 at 11:21:16AM +0200, Sakari Ailus wrote:
>> On Thu, Dec 17, 2020 at 11:43:30PM +0000, Daniel Scally wrote:
>>> To maintain consistency with software_node_unregister_nodes(), reverse
>>> the order in which the software_node_unregister_node_group() function
>>> unregisters nodes.
>
> ...
>
>>> void software_node_unregister_node_group(const struct software_node **node_group)
>>> {
>>> - unsigned int i;
>>> + unsigned int i = 0;
>>>
>>> if (!node_group)
>>> return;
>>>
>>> - for (i = 0; node_group[i]; i++)
>>> + while (node_group[i]->name)
>>
>> Why is this change made? node_group is a NULL-terminated array, and the
>> above accesses the name pointer on each entry before checking the entry is
>> non-NULL. Or do I miss something here?
>
> I believe it's a copy'n'paste typo.

Careless copy and paste yeah, my bad. I was doing it for consistency but
really should've just changed the ordering; I'll just drop that part.