Commit bef772eb authored by Aviad Yehezkel's avatar Aviad Yehezkel Committed by David S. Miller

net/mlx4_core: Fixing error flow in case of QUERY_FW failure

The order of operations was wrong on the teardown flow.
Signed-off-by: default avatarAviad Yehezkel <aviadye@mellanox.com>
Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 60d31c14
......@@ -1234,13 +1234,13 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
mlx4_info(dev, "non-primary physical function, skipping.\n");
else
mlx4_err(dev, "QUERY_FW command failed, aborting.\n");
goto unmap_bf;
return err;
}
err = mlx4_load_fw(dev);
if (err) {
mlx4_err(dev, "Failed to start FW, aborting.\n");
goto unmap_bf;
return err;
}
mlx4_cfg.log_pg_sz_m = 1;
......@@ -1304,7 +1304,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
err = mlx4_init_slave(dev);
if (err) {
mlx4_err(dev, "Failed to initialize slave\n");
goto unmap_bf;
return err;
}
err = mlx4_slave_cap(dev);
......@@ -1324,7 +1324,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
err = mlx4_QUERY_ADAPTER(dev, &adapter);
if (err) {
mlx4_err(dev, "QUERY_ADAPTER command failed, aborting.\n");
goto err_close;
goto unmap_bf;
}
priv->eq_table.inta_pin = adapter.inta_pin;
......@@ -1332,6 +1332,9 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
return 0;
unmap_bf:
unmap_bf_area(dev);
err_close:
mlx4_close_hca(dev);
......@@ -1344,8 +1347,6 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
mlx4_UNMAP_FA(dev);
mlx4_free_icm(dev, priv->fw.fw_icm, 0);
}
unmap_bf:
unmap_bf_area(dev);
return err;
}
......
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