Skip to content

Commit

Permalink
net: micrel: Fix receiving the timestamp in the frame for lan8841
Browse files Browse the repository at this point in the history
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 <horatiu.vultur@microchip.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
HoratiuVultur authored and davem330 committed May 14, 2024
1 parent c2e0c58 commit aea27a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/phy/micrel.c
Original file line number Diff line number Diff line change
Expand Up @@ -4676,7 +4676,8 @@ static int lan8841_suspend(struct phy_device *phydev)
struct kszphy_priv *priv = phydev->priv;
struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv;

ptp_cancel_worker_sync(ptp_priv->ptp_clock);
if (ptp_priv->ptp_clock)
ptp_cancel_worker_sync(ptp_priv->ptp_clock);

return genphy_suspend(phydev);
}
Expand Down

0 comments on commit aea27a9

Please sign in to comment.