Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] OF Node Reference Leak due to missing of_node_put() on the result of bcmgenet_mii_of_find_mdio() --
commit 3b29ae0c601cb855b049f7da529812b74080533b Author: Bartosz Golaszewski <[email protected]> net: bcmgenet: use platform_device_set_of_node() This commit encapsulates the assignment of the OF node for dynamically allocated platform devices using platform_device_set_of_node(). > diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c > b/drivers/net/ethernet/broadcom/genet/bcmmii.c > index a4e0d5a682687..0f0dbabfaabbc 100644 > --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c > +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c [ ... ] > @@ -490,8 +490,9 @@ static int bcmgenet_mii_register(struct bcmgenet_priv > *priv) > /* Retain this platform_device pointer for later cleanup */ > priv->mii_pdev = ppdev; > ppdev->dev.parent = &pdev->dev; > + > if (dn) > - ppdev->dev.of_node = bcmgenet_mii_of_find_mdio(priv); > + platform_device_set_of_node(ppdev, > bcmgenet_mii_of_find_mdio(priv)); [Severity: Medium] Does this leak the OF node reference? bcmgenet_mii_of_find_mdio() internally calls of_get_compatible_child(), which returns a device node with an incremented reference count. Previously, direct assignment allowed the platform device to consume this reference when it was eventually released. Now that platform_device_set_of_node() is used, it acquires its own reference internally. Should there be an explicit of_node_put() to drop the initial reference returned by bcmgenet_mii_of_find_mdio() so it isn't leaked? > else > ppd.phy_mask = ~0; > -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=10
