Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 24e31e474769 ("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>

authored by

Rosen Penev and committed by
Paolo Abeni
a4f800c4 d42bce41

+2 -4
+2 -4
drivers/net/mdio/mdio-realtek-rtl9300.c
··· 354 354 struct fwnode_handle *node) 355 355 { 356 356 struct rtl9300_mdio_chan *chan; 357 - struct fwnode_handle *child; 358 357 struct mii_bus *bus; 359 358 u32 mdio_bus; 360 359 int err; ··· 370 371 * compatible = "ethernet-phy-ieee802.3-c45". This does mean we can't 371 372 * support both c45 and c22 on the same MDIO bus. 372 373 */ 373 - fwnode_for_each_child_node(node, child) 374 + fwnode_for_each_child_node_scoped(node, child) 374 375 if (fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45")) 375 376 priv->smi_bus_is_c45[mdio_bus] = true; 376 377 ··· 408 409 { 409 410 struct rtl9300_mdio_priv *priv = dev_get_drvdata(dev); 410 411 struct device *parent = dev->parent; 411 - struct fwnode_handle *port; 412 412 int err; 413 413 414 414 struct fwnode_handle *ports __free(fwnode_handle) = ··· 416 418 return dev_err_probe(dev, -EINVAL, "%pfwP missing ethernet-ports\n", 417 419 dev_fwnode(parent)); 418 420 419 - fwnode_for_each_child_node(ports, port) { 421 + fwnode_for_each_child_node_scoped(ports, port) { 420 422 struct device_node *mdio_dn; 421 423 u32 addr; 422 424 u32 bus;