]> git.ipfire.org Git - thirdparty/linux.git/commit
net: mdio: realtek-rtl9300: Refactor otto_emdio_map_ports()
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Wed, 3 Jun 2026 17:59:18 +0000 (19:59 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Jun 2026 01:38:55 +0000 (18:38 -0700)
commitf369dd8ccf2dbce9166544e266e2b6ca974f98d9
tree81396f83f10b0c63a8c01c8f88b363c017ead90a
parent3a58a1b8d5052f5b5072fe2833ef048915192eaf
net: mdio: realtek-rtl9300: Refactor otto_emdio_map_ports()

This function has multiple issues:
- It uses __free low level cleanups
- It mixes "fwnode" and "of" functions

Convert this to a uniform "of" usage and manual reference counting
cleanup. With that also fix two subtle lookup bugs in the original
code.

  mdio_dn = phy_dn->parent;
  if (mdio_dn->parent != dev->of_node)
    continue;

This skips an API access and therefore misses reference counting.
Additionally in the case of a very buggy device tree, phy_dn might
be a root node. Looking up its grandparent leads to a NULL pointer
access.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://patch.msgid.link/20260603175924.123019-2-markus.stockhausen@gmx.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mdio/mdio-realtek-rtl9300.c