Skip to content

Commit ce2da64

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: sja1105: ensure phylink_replay_link_end() will not be missed
Most errors that can occur in sja1105_static_config_reload() are fatal (example: fail to communicate with hardware), but not all are. For example, sja1105_static_config_upload() -> kcalloc() may fail, and if that happens, we have called phylink_replay_link_begin() but never phylink_replay_link_end(). Under that circumstance, all port phylink instances are left in a state where the resolver is stopped with the PHYLINK_DISABLE_REPLAY bit set. We have effectively disabled link management with no way to recover from this condition. Avoid that situation by ensuring phylink_replay_link_begin() is always paired with phylink_replay_link_end(), regardless of whether we faced any errors during switch reset, configuration reload and general state reload. Fixes: 0b2edc5 ("net: dsa: sja1105: let phylink help with the replay of link callbacks") Signed-off-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 976703c commit ce2da64

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2341,10 +2341,11 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
23412341

23422342
rc = sja1105_reload_cbs(priv);
23432343

2344+
out:
23442345
dsa_switch_for_each_available_port(dp, ds)
23452346
if (dp->pl)
23462347
phylink_replay_link_end(dp->pl);
2347-
out:
2348+
23482349
mutex_unlock(&priv->mgmt_lock);
23492350
mutex_unlock(&priv->fdb_lock);
23502351

0 commit comments

Comments
 (0)