Skip to content

Commit aea27a9

Browse files
HoratiuVulturdavem330
authored andcommitted
net: micrel: Fix receiving the timestamp in the frame for lan8841
The blamed commit started to use the ptp workqueue to get the second part of the timestamp. And when the port was set down, then this workqueue is stopped. But if the config option NETWORK_PHY_TIMESTAMPING is not enabled, then the ptp_clock is not initialized so then it would crash when it would try to access the delayed work. So then basically by setting up and then down the port, it would crash. The fix consists in checking if the ptp_clock is initialized and only then cancel the delayed work. Fixes: cc75549 ("net: micrel: Change to receive timestamp in the frame for lan8841") Signed-off-by: Horatiu Vultur <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c2e0c58 commit aea27a9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/phy/micrel.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4676,7 +4676,8 @@ static int lan8841_suspend(struct phy_device *phydev)
46764676
struct kszphy_priv *priv = phydev->priv;
46774677
struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv;
46784678

4679-
ptp_cancel_worker_sync(ptp_priv->ptp_clock);
4679+
if (ptp_priv->ptp_clock)
4680+
ptp_cancel_worker_sync(ptp_priv->ptp_clock);
46804681

46814682
return genphy_suspend(phydev);
46824683
}

0 commit comments

Comments
 (0)