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

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: Validate PHY LED OPs presence before registering

Validate PHY LED OPs presence before registering and parsing them.
Defining LED nodes for a PHY driver that actually doesn't supports them
is redundant and useless.

It's also the case with Generic PHY driver used and a DT having LEDs
node for the specific PHY.

Skip it and report the error with debug print enabled.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241008194718.9682-1-ansuelsmth@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Christian Marangi and committed by
Paolo Abeni
16aef666 88dc9aeb

+11
+11
drivers/net/phy/phy_device.c
··· 3420 3420 if (!leds) 3421 3421 return 0; 3422 3422 3423 + /* Check if the PHY driver have at least an OP to 3424 + * set the LEDs. 3425 + */ 3426 + if (!(phydev->drv->led_brightness_set || 3427 + phydev->drv->led_blink_set || 3428 + phydev->drv->led_hw_control_set)) { 3429 + phydev_dbg(phydev, "ignoring leds node defined with no PHY driver support\n"); 3430 + goto exit; 3431 + } 3432 + 3423 3433 for_each_available_child_of_node_scoped(leds, led) { 3424 3434 err = of_phy_led(phydev, led); 3425 3435 if (err) { ··· 3439 3429 } 3440 3430 } 3441 3431 3432 + exit: 3442 3433 of_node_put(leds); 3443 3434 return 0; 3444 3435 }