dpaa2_eth_set_mac_addr(netdev_priv(net_dev));
                dpaa2_eth_update_tx_fqids(priv);
 
-               rtnl_lock();
                /* We can avoid locking because the "endpoint changed" IRQ
                 * handler is the only one who changes priv->mac at runtime,
                 * so we are not racing with anyone.
                        dpaa2_eth_disconnect_mac(priv);
                else
                        dpaa2_eth_connect_mac(priv);
-               rtnl_unlock();
        }
 
        return IRQ_HANDLED;
        else
                fsl_mc_free_irqs(ls_dev);
 
-       rtnl_lock();
        dpaa2_eth_disconnect_mac(priv);
-       rtnl_unlock();
        dpaa2_eth_free_rings(priv);
        free_percpu(priv->fd);
        free_percpu(priv->sgt_cache);
 
        }
        mac->phylink = phylink;
 
+       rtnl_lock();
        err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0);
+       rtnl_unlock();
        if (err) {
                netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err);
                goto err_phylink_destroy;
 
 void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
 {
+       rtnl_lock();
        phylink_disconnect_phy(mac->phylink);
+       rtnl_unlock();
+
        phylink_destroy(mac->phylink);
        dpaa2_pcs_destroy(mac);
        of_phy_put(mac->serdes_phy);
 
        }
 
        if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) {
-               rtnl_lock();
                /* We can avoid locking because the "endpoint changed" IRQ
                 * handler is the only one who changes priv->mac at runtime,
                 * so we are not racing with anyone.
                        dpaa2_switch_port_disconnect_mac(port_priv);
                else
                        dpaa2_switch_port_connect_mac(port_priv);
-               rtnl_unlock();
        }
 
 out:
 {
        struct ethsw_port_priv *port_priv = ethsw->ports[port_idx];
 
-       rtnl_lock();
        dpaa2_switch_port_disconnect_mac(port_priv);
-       rtnl_unlock();
        free_netdev(port_priv->netdev);
        ethsw->ports[port_idx] = NULL;
 }