diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-05-10 16:28:09 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-05-18 20:45:01 -0400 |
commit | 035b1032b57635e0b6015aed47dcb43c01e4ce7f (patch) | |
tree | aecc4879075df50b6364e4b4305c7894619fa281 /drivers/infiniband | |
parent | e605b743f33d697ad885f99ac8aac480ab6aa6de (diff) |
IB/mlx4: Fix mlx4_ib_add() error flow
We need to use a different loop index for mlx4_counter_alloc() and for
device_create_file() iterations: the mlx4_counter_alloc() loop index
is used in the error flow to free counters.
If the same loop index is used for device_create_file() and, say, the
device_create_file() loop fails on the first iteration, the allocated
counters will not be freed.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 7dfa7866d594..ee1c577238f7 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1160,7 +1160,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
1160 | { | 1160 | { |
1161 | struct mlx4_ib_dev *ibdev; | 1161 | struct mlx4_ib_dev *ibdev; |
1162 | int num_ports = 0; | 1162 | int num_ports = 0; |
1163 | int i; | 1163 | int i, j; |
1164 | int err; | 1164 | int err; |
1165 | struct mlx4_ib_iboe *iboe; | 1165 | struct mlx4_ib_iboe *iboe; |
1166 | 1166 | ||
@@ -1323,9 +1323,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
1323 | goto err_reg; | 1323 | goto err_reg; |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | for (i = 0; i < ARRAY_SIZE(mlx4_class_attributes); ++i) { | 1326 | for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) { |
1327 | if (device_create_file(&ibdev->ib_dev.dev, | 1327 | if (device_create_file(&ibdev->ib_dev.dev, |
1328 | mlx4_class_attributes[i])) | 1328 | mlx4_class_attributes[j])) |
1329 | goto err_notif; | 1329 | goto err_notif; |
1330 | } | 1330 | } |
1331 | 1331 | ||