Subject: Re: [PATCH] net: check all name nodes in __dev_alloc_name

From: Stephen Hemminger <[email-masked]>
Date: Thu, 18 Mar 2021 11:28:19 -0700

On Thu, 18 Mar 2021 10:06:52 +0100
Jiri Bohac <[email-masked]> wrote:

> On Wed, Mar 17, 2021 at 09:11:08PM -0700, Stephen Hemminger wrote:
> > Rather than copy/paste same code two places, why not make a helper function?  
> 
> I tried and in it was ugly (too many dependencies into the
> currecnt function)
> 
> Another option I considered and scratched was to opencode and
> modify list_for_each to also act on the dev->name_node
> which contains the list head. Or maybe one of the
> list_for_each_* variants could be directly misused for that.

That seems like overly complex and unhelpful option.

> I don't understand why this has been designed in such a
> non-standard way; why is the first node not part of the list and
> the head directly in the net_device?
> 
> In the end I considered the copy'n'paste of 9 lines the least
> ugly and most readable.
> 

Sure, make sense.