Commit 8146458f authored by Amit Cohen's avatar Amit Cohen Committed by David S. Miller

mlxsw: spectrum_span: Reduce nesting in mlxsw_sp_span_entry_configure()

Use early return to avoid unnecessary nesting.
Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 18021360
...@@ -622,18 +622,27 @@ mlxsw_sp_span_entry_configure(struct mlxsw_sp *mlxsw_sp, ...@@ -622,18 +622,27 @@ mlxsw_sp_span_entry_configure(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_span_entry *span_entry, struct mlxsw_sp_span_entry *span_entry,
struct mlxsw_sp_span_parms sparms) struct mlxsw_sp_span_parms sparms)
{ {
if (sparms.dest_port) { int err;
if (!sparms.dest_port)
goto set_parms;
if (sparms.dest_port->mlxsw_sp != mlxsw_sp) { if (sparms.dest_port->mlxsw_sp != mlxsw_sp) {
netdev_err(span_entry->to_dev, "Cannot mirror to %s, which belongs to a different mlxsw instance", netdev_err(span_entry->to_dev, "Cannot mirror to %s, which belongs to a different mlxsw instance",
sparms.dest_port->dev->name); sparms.dest_port->dev->name);
sparms.dest_port = NULL; sparms.dest_port = NULL;
} else if (span_entry->ops->configure(span_entry, sparms)) { goto set_parms;
}
err = span_entry->ops->configure(span_entry, sparms);
if (err) {
netdev_err(span_entry->to_dev, "Failed to offload mirror to %s", netdev_err(span_entry->to_dev, "Failed to offload mirror to %s",
sparms.dest_port->dev->name); sparms.dest_port->dev->name);
sparms.dest_port = NULL; sparms.dest_port = NULL;
} goto set_parms;
} }
set_parms:
span_entry->parms = sparms; span_entry->parms = sparms;
} }
......
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