Skip to content

Commit 3bc32fd

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: move PHY interrupt request to non-fail path
The blamed commit added code which could return an error after we requested the PHY interrupt. When we return an error, the caller will call phy_detach() which fails to free the interrupt. Rearrange the code such that failing operations happen before the interrupt is requested, thereby allowing phy_detach() to be used. Note that replacing phy_detach() with phy_disconnect() in these paths could lead to freeing an interrupt which was never requested. Fixes: 1942b1c ("net: phylink: make configuring clock-stop dependent on MAC support") Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1de95db commit 3bc32fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/phy/phylink.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,9 +2141,6 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
21412141
__ETHTOOL_LINK_MODE_MASK_NBITS, pl->supported,
21422142
__ETHTOOL_LINK_MODE_MASK_NBITS, phy->advertising);
21432143

2144-
if (phy_interrupt_is_valid(phy))
2145-
phy_request_interrupt(phy);
2146-
21472144
if (pl->config->mac_managed_pm)
21482145
phy->mac_managed_pm = true;
21492146

@@ -2160,6 +2157,9 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
21602157
ret = 0;
21612158
}
21622159

2160+
if (ret == 0 && phy_interrupt_is_valid(phy))
2161+
phy_request_interrupt(phy);
2162+
21632163
return ret;
21642164
}
21652165

0 commit comments

Comments
 (0)