Skip to content

Commit

Permalink
net: dsa: merge rtnl_lock sections in dsa_slave_create
Browse files Browse the repository at this point in the history
Currently dsa_slave_create() has two sequences of rtnl_lock/rtnl_unlock
in a row. Remove the rtnl_unlock() and rtnl_lock() in between, such that
the operation can execute slighly faster.

Signed-off-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
vladimiroltean authored and davem330 committed Jan 6, 2022
1 parent 904e112 commit e31dbd3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,14 +2022,12 @@ int dsa_slave_create(struct dsa_port *port)
}

rtnl_lock();

ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
rtnl_unlock();
if (ret && ret != -EOPNOTSUPP)
dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
ret, ETH_DATA_LEN, port->index);

rtnl_lock();

ret = register_netdevice(slave_dev);
if (ret) {
netdev_err(master, "error %d registering interface %s\n",
Expand Down

0 comments on commit e31dbd3

Please sign in to comment.