c3028357fe589471f534431f26ac5ee224272755
[openwrt/staging/jow.git] /
1 From 095ef388f714d622aa503fcccf20dc4095b72762 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
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
7 dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if
8 dpaa2_mac_connect() failed, or was never called.
9
10 The callers are these:
11
12 dpaa2_eth_disconnect_mac():
13
14 if (dpaa2_eth_is_type_phy(priv))
15 dpaa2_mac_disconnect(priv->mac);
16
17 dpaa2_switch_port_disconnect_mac():
18
19 if (dpaa2_switch_port_is_type_phy(port_priv))
20 dpaa2_mac_disconnect(port_priv->mac);
21
22 priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns
23 false, and dpaa2_mac_disconnect() is never called. Similar for
24 dpaa2-switch.
25
26 When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned
27 zero (success), and therefore, priv->mac->phylink is also a valid
28 pointer.
29
30 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
31 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
32 Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
33 Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
34 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
35 ---
36 drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 ---
37 1 file changed, 3 deletions(-)
38
39 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
40 +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
41 @@ -446,9 +446,6 @@ err_pcs_destroy:
42
43 void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
44 {
45 - if (!mac->phylink)
46 - return;
47 -
48 phylink_disconnect_phy(mac->phylink);
49 phylink_destroy(mac->phylink);
50 dpaa2_pcs_destroy(mac);