Skip to content

Commit a4f800c

Browse files
nehebPaolo Abeni
authored andcommitted
net: mdio: rtl9300: use scoped for loops
Currently in the return path, fwnode_handle_put calls are missing. Just use _scoped to avoid the issue. Fixes: 24e31e4 ("net: mdio: Add RTL9300 MDIO driver") Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20251217210153.14641-1-rosenp@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent d42bce4 commit a4f800c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/net/mdio/mdio-realtek-rtl9300.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ static int rtl9300_mdiobus_probe_one(struct device *dev, struct rtl9300_mdio_pri
354354
struct fwnode_handle *node)
355355
{
356356
struct rtl9300_mdio_chan *chan;
357-
struct fwnode_handle *child;
358357
struct mii_bus *bus;
359358
u32 mdio_bus;
360359
int err;
@@ -371,7 +370,7 @@ static int rtl9300_mdiobus_probe_one(struct device *dev, struct rtl9300_mdio_pri
371370
* compatible = "ethernet-phy-ieee802.3-c45". This does mean we can't
372371
* support both c45 and c22 on the same MDIO bus.
373372
*/
374-
fwnode_for_each_child_node(node, child)
373+
fwnode_for_each_child_node_scoped(node, child)
375374
if (fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45"))
376375
priv->smi_bus_is_c45[mdio_bus] = true;
377376

@@ -409,7 +408,6 @@ static int rtl9300_mdiobus_map_ports(struct device *dev)
409408
{
410409
struct rtl9300_mdio_priv *priv = dev_get_drvdata(dev);
411410
struct device *parent = dev->parent;
412-
struct fwnode_handle *port;
413411
int err;
414412

415413
struct fwnode_handle *ports __free(fwnode_handle) =
@@ -418,7 +416,7 @@ static int rtl9300_mdiobus_map_ports(struct device *dev)
418416
return dev_err_probe(dev, -EINVAL, "%pfwP missing ethernet-ports\n",
419417
dev_fwnode(parent));
420418

421-
fwnode_for_each_child_node(ports, port) {
419+
fwnode_for_each_child_node_scoped(ports, port) {
422420
struct device_node *mdio_dn;
423421
u32 addr;
424422
u32 bus;

0 commit comments

Comments
 (0)