]> www.infradead.org Git - users/griffoul/linux.git/commitdiff
net: thunder_bgx: add a missing of_node_put
authorRosen Penev <rosenp@gmail.com>
Mon, 1 Sep 2025 21:30:18 +0000 (14:30 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Sep 2025 23:56:04 +0000 (16:56 -0700)
phy_np needs to get freed, just like the other child nodes.

Fixes: 5fc7cf179449 ("net: thunderx: Cleanup PHY probing code.")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250901213018.47392-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/cavium/thunder/thunder_bgx.c

index 21495b5dce254d0527851ea0cc04bb07ab9ee0b5..0f913db4814ea8c0149684837f71eb8fbe32b276 100644 (file)
@@ -1493,13 +1493,17 @@ static int bgx_init_of_phy(struct bgx *bgx)
                 * this cortina phy, for which there is no driver
                 * support, ignore it.
                 */
-               if (phy_np &&
-                   !of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
-                       /* Wait until the phy drivers are available */
-                       pd = of_phy_find_device(phy_np);
-                       if (!pd)
-                               goto defer;
-                       bgx->lmac[lmac].phydev = pd;
+               if (phy_np) {
+                       if (!of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
+                               /* Wait until the phy drivers are available */
+                               pd = of_phy_find_device(phy_np);
+                               if (!pd) {
+                                       of_node_put(phy_np);
+                                       goto defer;
+                               }
+                               bgx->lmac[lmac].phydev = pd;
+                       }
+                       of_node_put(phy_np);
                }
 
                lmac++;