]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: dsa: qca8k: fix led devicename when using external mdio bus
authorGeorge Moussalem <george.moussalem@outlook.com>
Mon, 8 Jun 2026 07:22:08 +0000 (11:22 +0400)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 Jun 2026 22:02:52 +0000 (15:02 -0700)
The qca8k dsa switch can use either an external or internal mdio bus.
This depends on whether the mdio node is defined under the switch node
itself. Upon registering the internal mdio bus, the internal_mdio_bus
of the dsa switch is assigned to this bus. When an external mdio bus is
used, the driver still uses the internal_mdio_bus id which is used to
create the device names of the leds.
This leads to the leds being prefixed with '(efault)' as the
internal_mii_bus is null. So let's fix this by adding a null check and
use the devicename of the external bus instead when an external bus is
configured.

Fixes: 1e264f9d2918 ("net: dsa: qca8k: add LEDs basic support")
Signed-off-by: George Moussalem <george.moussalem@outlook.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20260608-qca8k-leds-fix-v3-1-a915bb2f37ae@outlook.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/qca/qca8k-leds.c

index 43ac68052baf9f9926aaf4a9d8d09640f9022fcd..ef496e345a4e7dd5b9fb805b8e0ff3cce56e2986 100644 (file)
@@ -429,7 +429,8 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p
                init_data.fwnode = led;
                init_data.devname_mandatory = true;
                init_data.devicename = kasprintf(GFP_KERNEL, "%s:0%d",
-                                                priv->internal_mdio_bus->id,
+                                                priv->internal_mdio_bus ?
+                                                priv->internal_mdio_bus->id : priv->bus->id,
                                                 port_num);
                if (!init_data.devicename) {
                        fwnode_handle_put(led);