public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/mlx4: Use common error handling code in __mlx4_ib_create_flow()
@ 2017-10-26 16:12 SF Markus Elfring
  2017-10-27  0:33 ` Dennis Dalessandro
  2017-10-27 19:39 ` Leon Romanovsky
  0 siblings, 2 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-10-26 16:12 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dennis Dalessandro,
	Doug Ledford, Hal Rosenstock, Leon Romanovsky, Sean Hefty,
	Yishai Hadas, Yuval Shaia
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA

From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
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-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-30  8:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26 16:12 [PATCH] IB/mlx4: Use common error handling code in __mlx4_ib_create_flow() SF Markus Elfring
2017-10-27  0:33 ` Dennis Dalessandro
2017-10-27  7:34   ` SF Markus Elfring
     [not found]     ` <0c92fc8e-ecb8-c7ed-0b4c-721752297222-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2017-10-27 19:36       ` Leon Romanovsky
     [not found]         ` <20171027193601.GI16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-30  8:04           ` SF Markus Elfring
     [not found]             ` <e2febce9-4b80-a40e-024e-5c24964301ac-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2017-10-30  8:34               ` Leon Romanovsky
2017-10-30  8:47                 ` SF Markus Elfring
     [not found]   ` <70843f43-03c5-8295-643a-4f228ff2e907-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-27 19:44     ` [PATCH] " Leon Romanovsky
2017-10-27 19:39 ` Leon Romanovsky
2017-10-27 20:53   ` SF Markus Elfring
2017-10-27 21:54     ` Dennis Dalessandro
2017-10-28  7:39       ` SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox