[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54d751aa-e265-4e5a-9337-5c2d10a7583d@broadcom.com>
Date: Thu, 4 Jan 2024 09:37:01 -0800
From: Florian Fainelli <florian.fainelli@...adcom.com>
To: Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Luiz Angelo Daros de Luca <luizluca@...il.com>,
Alvin Šipraga <alsi@...g-olufsen.dk>,
Linus Walleij <linus.walleij@...aro.org>, Hauke Mehrtens <hauke@...ke-m.de>,
Christian Marangi <ansuelsmth@...il.com>, Arınç ÜNAL
<arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next 04/10] net: dsa: qca8k: put MDIO bus OF node on
qca8k_mdio_register() failure
On 1/4/24 06:00, Vladimir Oltean wrote:
> of_get_child_by_name() gives us an OF node with an elevated refcount,
> which should be dropped when we're done with it. This is so that,
> if (of_node_check_flag(node, OF_DYNAMIC)) is true, the node's memory can
> eventually be freed.
>
> There are 2 distinct paths to be considered in qca8k_mdio_register():
>
> - devm_of_mdiobus_register() succeeds: since commit 3b73a7b8ec38 ("net:
> mdio_bus: add refcounting for fwnodes to mdiobus"), the MDIO core
> treats this well.
>
> - devm_of_mdiobus_register() or anything up to that point fails: it is
> the duty of the qca8k driver to release the OF node.
>
> This change addresses the second case by making sure that the OF node
> reference is not leaked.
>
> The "mdio" node may be NULL, but of_node_put(NULL) is safe.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Reviewed-by: Florian Fainelli <florian.fainelli@...adcom.com>
--
Florian
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4221 bytes)
Powered by blists - more mailing lists