Skip to content

Commit a9b24b3

Browse files
d4nuu8kuba-moo
authored andcommitted
net: phy: realtek: add error handling to rtl8211f_get_wol
We should check if the WOL settings was successfully read from the PHY. In case this fails we cannot just use the error code and proceed. Signed-off-by: Daniel Braunwarth <[email protected]> Reported-by: Jon Hunter <[email protected]> Closes: https://lore.kernel.org/[email protected] Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f6fa45d commit a9b24b3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/phy/realtek/realtek_main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,15 @@ static irqreturn_t rtl8211f_handle_interrupt(struct phy_device *phydev)
436436

437437
static void rtl8211f_get_wol(struct phy_device *dev, struct ethtool_wolinfo *wol)
438438
{
439+
int wol_events;
440+
439441
wol->supported = WAKE_MAGIC;
440-
if (phy_read_paged(dev, RTL8211F_WOL_SETTINGS_PAGE, RTL8211F_WOL_SETTINGS_EVENTS)
441-
& RTL8211F_WOL_EVENT_MAGIC)
442+
443+
wol_events = phy_read_paged(dev, RTL8211F_WOL_SETTINGS_PAGE, RTL8211F_WOL_SETTINGS_EVENTS);
444+
if (wol_events < 0)
445+
return;
446+
447+
if (wol_events & RTL8211F_WOL_EVENT_MAGIC)
442448
wol->wolopts = WAKE_MAGIC;
443449
}
444450

0 commit comments

Comments
 (0)