aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDotan Barak <dotanb@dev.mellanox.co.il>2012-10-24 21:12:49 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-26 03:34:15 -0400
commitbfc0d8c3de31a51e671e2c1564fd194fa6b00179 (patch)
tree97a0c526f58b73d2ff26d5fc83c9cfdbb02dea1a /drivers
parent2b39a06198a0fbaf44a69f435c5d2b4280a0c10e (diff)
net/mlx4_core: Unmap UAR also in the case of error flow
If a failure takes place during the EQ creation, we need to unmap the UAR memory block too. Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il> Signed-off-by: Uri Habusha <urih@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 51c764901ad2..083767b55c8c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -843,6 +843,18 @@ static void __iomem *mlx4_get_eq_uar(struct mlx4_dev *dev, struct mlx4_eq *eq)
843 return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4); 843 return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4);
844} 844}
845 845
846static void mlx4_unmap_uar(struct mlx4_dev *dev)
847{
848 struct mlx4_priv *priv = mlx4_priv(dev);
849 int i;
850
851 for (i = 0; i < mlx4_num_eq_uar(dev); ++i)
852 if (priv->eq_table.uar_map[i]) {
853 iounmap(priv->eq_table.uar_map[i]);
854 priv->eq_table.uar_map[i] = NULL;
855 }
856}
857
846static int mlx4_create_eq(struct mlx4_dev *dev, int nent, 858static int mlx4_create_eq(struct mlx4_dev *dev, int nent,
847 u8 intr, struct mlx4_eq *eq) 859 u8 intr, struct mlx4_eq *eq)
848{ 860{
@@ -1207,6 +1219,7 @@ err_out_unmap:
1207 mlx4_free_irqs(dev); 1219 mlx4_free_irqs(dev);
1208 1220
1209err_out_bitmap: 1221err_out_bitmap:
1222 mlx4_unmap_uar(dev);
1210 mlx4_bitmap_cleanup(&priv->eq_table.bitmap); 1223 mlx4_bitmap_cleanup(&priv->eq_table.bitmap);
1211 1224
1212err_out_free: 1225err_out_free:
@@ -1231,10 +1244,7 @@ void mlx4_cleanup_eq_table(struct mlx4_dev *dev)
1231 if (!mlx4_is_slave(dev)) 1244 if (!mlx4_is_slave(dev))
1232 mlx4_unmap_clr_int(dev); 1245 mlx4_unmap_clr_int(dev);
1233 1246
1234 for (i = 0; i < mlx4_num_eq_uar(dev); ++i) 1247 mlx4_unmap_uar(dev);
1235 if (priv->eq_table.uar_map[i])
1236 iounmap(priv->eq_table.uar_map[i]);
1237
1238 mlx4_bitmap_cleanup(&priv->eq_table.bitmap); 1248 mlx4_bitmap_cleanup(&priv->eq_table.bitmap);
1239 1249
1240 kfree(priv->eq_table.uar_map); 1250 kfree(priv->eq_table.uar_map);