mlx5: Fix error flow in add_keys
authorEli Cohen <eli@dev.mellanox.co.il>
Tue, 2 Dec 2014 10:26:19 +0000 (12:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Dec 2014 01:45:56 +0000 (20:45 -0500)
If mlx5_core_create_mkey fails, decrease the pending counter to undo the
previous increment.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/hw/mlx5/mr.c

index 4c89b64aa9cfb1528a1ba9ad34a43bc07ea3ea97..5a80dd9937612f5804d64135838ff389570e6b6e 100644 (file)
@@ -159,6 +159,9 @@ static int add_keys(struct mlx5_ib_dev *dev, int c, int num)
                                            sizeof(*in), reg_mr_callback,
                                            mr, &mr->out);
                if (err) {
+                       spin_lock_irq(&ent->lock);
+                       ent->pending--;
+                       spin_unlock_irq(&ent->lock);
                        mlx5_ib_warn(dev, "create mkey failed %d\n", err);
                        kfree(mr);
                        break;