[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ed41df0-7d35-4f64-87d7-e0717d9c172b@huawei.com>
Date: Fri, 25 Oct 2024 10:41:22 +0800
From: "zhangzekun (A)" <zhangzekun11@...wei.com>
To: Andrew Lunn <andrew@...n.ch>
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()
在 2024/10/24 19:56, Andrew Lunn 写道:
> On Thu, Oct 24, 2024 at 09:59:08AM +0800, Zhang Zekun wrote:
>> of_find_node_by_name() will decrease the refcount of the device_node.
>> So, get the device_node before passing to it.
>
> This seems like an odd design. Why does it decrement the reference
> count?
>
> Rather than adding missing of_node_get() everywhere, should we be
> thinking about the design and fixing it to be more logical?
>
> Andrew
Hi, Andrew,
of_find* API is used as a iterater of the for loop defined in
"include/linux/of.h", which is already wildly used. I think is
reasonable to put the previous node when implement a loop, besides, the
functionality has been documented before the definiton of of_find* APIs.
The logical change of these series of APIs would require a large number
of conversions in the driver subsys, and I don't think it it necessary.
Thanks,
Zekun
Powered by blists - more mailing lists