net: dsa: sja1105: Really fix panic on unregistering PTP clock
The IS_ERR_OR_NULL(priv->clock) check inside
sja1105_ptp_clock_unregister() is preventing cancel_delayed_work_sync
from actually being run.
Additionally, sja1105_ptp_clock_unregister() does not actually get run,
when placed in sja1105_remove(). The DSA switch gets torn down, but the
sja1105 module does not get unregistered. So sja1105_ptp_clock_unregister
needs to be moved to sja1105_teardown, to be symmetrical with
sja1105_ptp_clock_register which is called from the DSA sja1105_setup.
It is strange to fix a "fixes" patch, but the probe failure can only be
seen when the attached PHY does not respond to MDIO (issue which I can't
pinpoint the reason to) and it goes away after I power-cycle the board.
This time the patch was validated on a failing board, and the kernel
panic from the fixed commit's message can no longer be seen.
Fixes: 29dd908d35
("net: dsa: sja1105: Cancel PTP delayed work on unregister")
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
4b7da3d808
commit
6cb0abbdf9
@@ -369,16 +369,15 @@ int sja1105_ptp_clock_register(struct sja1105_private *priv)
|
||||
.mult = SJA1105_CC_MULT,
|
||||
};
|
||||
mutex_init(&priv->ptp_lock);
|
||||
INIT_DELAYED_WORK(&priv->refresh_work, sja1105_ptp_overflow_check);
|
||||
|
||||
schedule_delayed_work(&priv->refresh_work, SJA1105_REFRESH_INTERVAL);
|
||||
|
||||
priv->ptp_caps = sja1105_ptp_caps;
|
||||
|
||||
priv->clock = ptp_clock_register(&priv->ptp_caps, ds->dev);
|
||||
if (IS_ERR_OR_NULL(priv->clock))
|
||||
return PTR_ERR(priv->clock);
|
||||
|
||||
INIT_DELAYED_WORK(&priv->refresh_work, sja1105_ptp_overflow_check);
|
||||
schedule_delayed_work(&priv->refresh_work, SJA1105_REFRESH_INTERVAL);
|
||||
|
||||
return sja1105_ptp_reset(priv);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user