lkml.org 
[lkml]   [2017]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] IB/mlx4: Use common error handling code in __mlx4_ib_create_flow()
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 26 Oct 2017 17:54:15 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/hw/mlx4/main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index c636842c5be0..4a598c48ea1c 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1691,8 +1691,8 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
mdev, qp, default_table + default_flow,
mailbox->buf + size);
if (ret < 0) {
- mlx4_free_cmd_mailbox(mdev->dev, mailbox);
- return -EINVAL;
+ ret = -EINVAL;
+ goto free_mailbox;
}
size += ret;
}
@@ -1700,8 +1700,8 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
ret = parse_flow_attr(mdev->dev, qp->qp_num, ib_flow,
mailbox->buf + size);
if (ret < 0) {
- mlx4_free_cmd_mailbox(mdev->dev, mailbox);
- return -EINVAL;
+ ret = -EINVAL;
+ goto free_mailbox;
}
ib_flow += ((union ib_flow_spec *) ib_flow)->size;
size += ret;
@@ -1726,7 +1726,7 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
pr_err("Device managed flow steering is disabled. Fail to register network rule.\n");
else if (ret)
pr_err("Invalid argument. Fail to register network rule.\n");
-
+free_mailbox:
mlx4_free_cmd_mailbox(mdev->dev, mailbox);
return ret;
}
--
2.14.3
\
 
 \ /
  Last update: 2017-10-26 18:13    [W:0.068 / U:2.084 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site