[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7f2266a-12c0-7369-952b-fbaa787de125@huawei.com>
Date: Fri, 2 Dec 2022 10:14:47 +0800
From: Zeng Heng <zengheng4@...wei.com>
To: Andrew Lunn <andrew@...n.ch>,
Yang Yingliang <yangyingliang@...wei.com>
CC: <f.fainelli@...il.com>, <pabeni@...hat.com>, <kuba@...nel.org>,
<linux@...linux.org.uk>, <davem@...emloft.net>,
<edumazet@...gle.com>, <hkallweit1@...il.com>,
<netdev@...r.kernel.org>, <liwei391@...wei.com>
Subject: Re: [PATCH] net: mdio: fix unbalanced fwnode reference count in
mdio_device_release()
On 2022/12/1 23:27, Andrew Lunn wrote:
> On Thu, Dec 01, 2022 at 05:22:02PM +0800, Zeng Heng wrote:
>> There is warning report about of_node refcount leak
>> while probing mdio device:
>>
>> OF: ERROR: memory leak, expected refcount 1 instead of 2,
>> of_node_get()/of_node_put() unbalanced - destroy cset entry:
>> attach overlay node /spi/soc@...dio@...700c0/ethernet@4
>>
>> In of_mdiobus_register_device(), we increase fwnode refcount
>> by fwnode_handle_get() before associating the of_node with
>> mdio device, but it has never been decreased after that.
>> Since that, in mdio_device_release(), it needs to call
>> fwnode_handle_put() in addition instead of calling kfree()
>> directly.
>>
>> After above, just calling mdio_device_free() in the error handle
>> path of of_mdiobus_register_device() is enough to keep the
>> refcount balanced.
> How does this interact with:
>
> https://lore.kernel.org/netdev/20221201033838.1938765-1-yangyingliang@huawei.com/T/
>
> Andrew
No, they don't interact with each other, because they fix different
issues respectively.
The patch sent by me is about eliminating refcount warning in the normal
and error
handling route of mdio_device_register(), while the one sent by
Yingliang (as you concern about)
is fixing refcount warning in the error handle path of
phy_device_register().
Yingliang and I work on cleaning the warning report and enhancing the
quality of kernel.
I am not sure, for your convenience, shall I need to send my patch to
Yingliang and let him
edit them into a set of patches?
With best regards,
Zeng Heng
Powered by blists - more mailing lists