[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0f417672-f1e0-4404-ba9e-67ddb7f6d3c5@lunn.ch>
Date: Fri, 1 Nov 2024 14:03:58 +0100
From: Andrew Lunn <andrew@...n.ch>
To: "zhangzekun (A)" <zhangzekun11@...wei.com>
Cc: justin.chen@...adcom.com, florian.fainelli@...adcom.com,
andrew+netdev@...n.ch, davem@...emloft.net, o.rempel@...gutronix.de,
kory.maincent@...tlin.com, horms@...nel.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
chenjun102@...wei.com
Subject: Re: [PATCH net 1/2] net: bcmasp: Add missing of_node_get() before
of_find_node_by_name()
> > Do you have a rough idea how many missing gets there are because of
> > this poor design?
> >
> > A quick back of the envelope analysis, which will be inaccurate...
> >
> > $ grep -r of_find_node_by_name | wc
> > 68 348 5154
> >
> > Now, a lot of these pass NULL as the node pointer:
> >
> > $ grep -r of_find_node_by_name | grep NULL | wc
> > 47 232 3456
> >
> > so there are only about 20 call sites which are interesting. Have you
> > looked at them all?
> >
> > What percentage of these are not in a loop and hence don't want the
> > decrement?
> >
> > What percentage are broken?
> >
> > We have to assume a similar number of new instances will also be
> > broken, so you have an endless job of fixing these new broken cases as
> > they are added.
> >
> > If you found that 15 of the 20 are broken, it makes little difference
> > changing the call to one which is not broken by design. If it is only
> > 5 from 20 which are broken, then yes, it might be considered pointless
> > churn changing them all, and you have a little job for life...
> >
> > Andrew
>
> Hi, Andrew,
>
> There are about 10/20 call sites might have this problem, spreading in six
> files. May be we can fix these problems instead of adding a new API?
So you are saying 50% of the call sites are wrong! We should fix the
API if so many developers are getting it wrong.
Andrew
Powered by blists - more mailing lists