Commit ccbd7822 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Paolo Abeni

net: dpaa2-mac: remove defensive check in dpaa2_mac_disconnect()

dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if
dpaa2_mac_connect() failed, or was never called.

The callers are these:

dpaa2_eth_disconnect_mac():

	if (dpaa2_eth_is_type_phy(priv))
		dpaa2_mac_disconnect(priv->mac);

dpaa2_switch_port_disconnect_mac():

	if (dpaa2_switch_port_is_type_phy(port_priv))
		dpaa2_mac_disconnect(port_priv->mac);

priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns
false, and dpaa2_mac_disconnect() is never called. Similar for
dpaa2-switch.

When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned
zero (success), and therefore, priv->mac->phylink is also a valid
pointer.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Tested-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 38533388
...@@ -448,9 +448,6 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac) ...@@ -448,9 +448,6 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
void dpaa2_mac_disconnect(struct dpaa2_mac *mac) void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
{ {
if (!mac->phylink)
return;
phylink_disconnect_phy(mac->phylink); phylink_disconnect_phy(mac->phylink);
phylink_destroy(mac->phylink); phylink_destroy(mac->phylink);
dpaa2_pcs_destroy(mac); dpaa2_pcs_destroy(mac);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment