• Vladimir Oltean's avatar
    net: dsa: sja1105: Really fix panic on unregistering PTP clock · 6cb0abbd
    Vladimir Oltean authored
    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: 29dd908d ("net: dsa: sja1105: Cancel PTP delayed work on unregister")
    Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6cb0abbd
sja1105_main.c 62.6 KB