701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 095ef388f714d622aa503fcccf20dc4095b72762 Mon Sep 17 00:00:00 2001
  2. From: Vladimir Oltean <[email protected]>
  3. Date: Tue, 29 Nov 2022 16:12:13 +0200
  4. Subject: [PATCH 06/14] net: dpaa2-mac: remove defensive check in
  5. dpaa2_mac_disconnect()
  6. dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if
  7. dpaa2_mac_connect() failed, or was never called.
  8. The callers are these:
  9. dpaa2_eth_disconnect_mac():
  10. if (dpaa2_eth_is_type_phy(priv))
  11. dpaa2_mac_disconnect(priv->mac);
  12. dpaa2_switch_port_disconnect_mac():
  13. if (dpaa2_switch_port_is_type_phy(port_priv))
  14. dpaa2_mac_disconnect(port_priv->mac);
  15. priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns
  16. false, and dpaa2_mac_disconnect() is never called. Similar for
  17. dpaa2-switch.
  18. When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned
  19. zero (success), and therefore, priv->mac->phylink is also a valid
  20. pointer.
  21. Signed-off-by: Vladimir Oltean <[email protected]>
  22. Reviewed-by: Andrew Lunn <[email protected]>
  23. Reviewed-by: Ioana Ciornei <[email protected]>
  24. Tested-by: Ioana Ciornei <[email protected]>
  25. Signed-off-by: Paolo Abeni <[email protected]>
  26. ---
  27. drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 ---
  28. 1 file changed, 3 deletions(-)
  29. --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
  30. +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
  31. @@ -446,9 +446,6 @@ err_pcs_destroy:
  32. void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
  33. {
  34. - if (!mac->phylink)
  35. - return;
  36. -
  37. phylink_disconnect_phy(mac->phylink);
  38. phylink_destroy(mac->phylink);
  39. dpaa2_pcs_destroy(mac);