Commit c7a19018 authored by Tristram Ha's avatar Tristram Ha Committed by Jakub Kicinski

net: dsa: microchip: Fix Wake-on-LAN check to not return an error

The wol variable in ksz_port_set_mac_address() is declared with random
data, but the code in ksz_get_wol call may not be executed so the
WAKE_MAGIC check may be invalid resulting in an error message when
setting a MAC address after starting the DSA driver.

Fixes: 3b454b63 ("net: dsa: microchip: ksz9477: Add Wake on Magic Packet support")
Signed-off-by: default avatarTristram Ha <tristram.ha@microchip.com>
Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20240805235200.24982-1-Tristram.Ha@microchip.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3e7917c0
......@@ -3764,6 +3764,11 @@ static int ksz_port_set_mac_address(struct dsa_switch *ds, int port,
return -EBUSY;
}
/* Need to initialize variable as the code to fill in settings may
* not be executed.
*/
wol.wolopts = 0;
ksz_get_wol(ds, dp->index, &wol);
if (wol.wolopts & WAKE_MAGIC) {
dev_err(ds->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment