Skip to content

Commit c7a1901

Browse files
triha2workkuba-moo
authored andcommitted
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: 3b454b6 ("net: dsa: microchip: ksz9477: Add Wake on Magic Packet support") Signed-off-by: Tristram Ha <[email protected]> Reviewed-by: Oleksij Rempel <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3e7917c commit c7a1901

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,6 +3764,11 @@ static int ksz_port_set_mac_address(struct dsa_switch *ds, int port,
37643764
return -EBUSY;
37653765
}
37663766

3767+
/* Need to initialize variable as the code to fill in settings may
3768+
* not be executed.
3769+
*/
3770+
wol.wolopts = 0;
3771+
37673772
ksz_get_wol(ds, dp->index, &wol);
37683773
if (wol.wolopts & WAKE_MAGIC) {
37693774
dev_err(ds->dev,

0 commit comments

Comments
 (0)