Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628843 > unrolled thread

[PATCH v2 00/12] InfiniBand-OCRDMA: Fine-tuning for several function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-22 16:30 +0200
Last post2017-04-22 17:00 +0200
Articles 4 on this page of 24 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 00/12] InfiniBand-OCRDMA: Fine-tuning for several function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:30 +0200
    [PATCH v2 01/12] IB/ocrdma: Use kcalloc() in  ocrdma_mbx_alloc_pd_range() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:40 +0200
      Re: [PATCH v2 01/12] IB/ocrdma: Use kcalloc() in ocrdma_mbx_alloc_pd_range() Devesh Sharma <devesh.sharma@broadcom.com> - 2017-04-24 18:30 +0200
        Re: [PATCH v2 01/12] IB/ocrdma: Use kcalloc() in  ocrdma_mbx_alloc_pd_range() Doug Ledford <dledford@redhat.com> - 2017-04-25 19:10 +0200
    [PATCH v2 02/12] IB/ocrdma: Use kcalloc() in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:40 +0200
    [PATCH v2 03/12] IB/ocrdma: Improve size determinations in ten  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:40 +0200
      Re: [PATCH v2 03/12] IB/ocrdma: Improve size determinations in ten  functions Leon Romanovsky <leon@kernel.org> - 2017-04-23 09:40 +0200
        Re: [PATCH v2 03/12] IB/ocrdma: Improve size determinations in ten  functions Dennis Dalessandro <dennis.dalessandro@intel.com> - 2017-04-24 15:00 +0200
          Re: IB/ocrdma: Improve size determinations in ten functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 15:30 +0200
            Re: IB/ocrdma: Improve size determinations in ten functions Leon Romanovsky <leon@kernel.org> - 2017-04-24 16:40 +0200
              Re: IB/ocrdma: Improve size determinations in ten functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 17:00 +0200
          Re: [PATCH v2 03/12] IB/ocrdma: Improve size determinations in ten  functions Doug Ledford <dledford@redhat.com> - 2017-04-24 18:40 +0200
            Re: [PATCH v2 03/12] IB/ocrdma: Improve size determinations in ten  functions Leon Romanovsky <leon@kernel.org> - 2017-04-24 20:10 +0200
        Re: [PATCH v2 03/12] IB/ocrdma: Improve size determinations in ten  functions Doug Ledford <dledford@redhat.com> - 2017-04-24 18:40 +0200
    [PATCH v2 07/12] IB/ocrdma: Adjust 21 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:50 +0200
      Re: [PATCH v2 07/12] IB/ocrdma: Adjust 21 checks for null pointers Leon Romanovsky <leon@kernel.org> - 2017-04-23 08:10 +0200
    [PATCH v2 04/12] IB/ocrdma: Delete unnecessary variable  initialisations in ocrdma_mbx_get_dcbx_config() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:50 +0200
    [PATCH v2 08/12] IB/ocrdma: Delete an error message for a failed  memory allocation in ocrdma_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:50 +0200
    [PATCH v2 06/12] IB/ocrdma: Use kmalloc_array() in  ocrdma_create_srq() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:50 +0200
    [PATCH v2 05/12] IB/ocrdma: Delete unnecessary braces SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 16:50 +0200
    [PATCH v2 11/12] IB/ocrdma: Delete an unnecessary variable in  ocrdma_dealloc_pd() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 17:00 +0200
    [PATCH v2 12/12] IB/ocrdma: One jump label less in  ocrdma_alloc_ucontext_pd() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 17:00 +0200
    [PATCH v2 09/12] IB/ocrdma: Delete an unnecessary variable assignment  in ocrdma_alloc_mr() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 17:00 +0200
    [PATCH v2 10/12] IB/ocrdma: Returning only value constants in  ocrdma_resize_cq() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-22 17:00 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1628853 — [PATCH v2 11/12] IB/ocrdma: Delete an unnecessary variable in ocrdma_dealloc_pd()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-22 17:00 +0200
Subject[PATCH v2 11/12] IB/ocrdma: Delete an unnecessary variable in ocrdma_dealloc_pd()
Message-ID<tz4FY-47X-3@gated-at.bofh.it>
In reply to#1628843
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 22 Apr 2017 15:32:05 +0200

1. Return zero in one case directly.

2. Return the value from a call of the function "_ocrdma_dealloc_pd"
   without using an extra assignment for the local variable.

3. Remove the variable "status" in this function then.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 60b8813aff42..712c0dc9c980 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -754,7 +754,6 @@ int ocrdma_dealloc_pd(struct ib_pd *ibpd)
 	struct ocrdma_pd *pd = get_ocrdma_pd(ibpd);
 	struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device);
 	struct ocrdma_ucontext *uctx = NULL;
-	int status = 0;
 	u64 usr_db;
 
 	uctx = pd->uctx;
@@ -768,11 +767,10 @@ int ocrdma_dealloc_pd(struct ib_pd *ibpd)
 
 		if (is_ucontext_pd(uctx, pd)) {
 			ocrdma_release_ucontext_pd(uctx);
-			return status;
+			return 0;
 		}
 	}
-	status = _ocrdma_dealloc_pd(dev, pd);
-	return status;
+	return _ocrdma_dealloc_pd(dev, pd);
 }
 
 static int ocrdma_alloc_lkey(struct ocrdma_dev *dev, struct ocrdma_mr *mr,
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1628854 — [PATCH v2 12/12] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-22 17:00 +0200
Subject[PATCH v2 12/12] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()
Message-ID<tz4FY-47X-5@gated-at.bofh.it>
In reply to#1628843
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 22 Apr 2017 15:45:21 +0200

This issue was detected by using the Coccinelle software.

1. Return directly if a call of the function "_ocrdma_alloc_pd" failed.

2. Reduce the scope for the local variable "status" to one case
   of an if statement.

3. Delete the jump label "err" then.

4. Return zero as a constant at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 712c0dc9c980..fbceb9d9d5b0 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -484,19 +484,17 @@ static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev *dev,
 				    struct ocrdma_ucontext *uctx,
 				    struct ib_udata *udata)
 {
-	int status = 0;
-
 	uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata);
 	if (IS_ERR(uctx->cntxt_pd)) {
-		status = PTR_ERR(uctx->cntxt_pd);
+		int status = PTR_ERR(uctx->cntxt_pd);
+
 		uctx->cntxt_pd = NULL;
-		goto err;
+		return status;
 	}
 
 	uctx->cntxt_pd->uctx = uctx;
 	uctx->cntxt_pd->ibpd.device = &dev->ibdev;
-err:
-	return status;
+	return 0;
 }
 
 static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx)
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1628855 — [PATCH v2 09/12] IB/ocrdma: Delete an unnecessary variable assignment in ocrdma_alloc_mr()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-22 17:00 +0200
Subject[PATCH v2 09/12] IB/ocrdma: Delete an unnecessary variable assignment in ocrdma_alloc_mr()
Message-ID<tz4FY-47X-11@gated-at.bofh.it>
In reply to#1628843
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 22 Apr 2017 15:07:41 +0200

Delete an assignment for the local variable "status" in an if branch
because the desired failure indication is already specified by a constant
error code at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index c804889db7e1..2dc399eeeefd 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -3022,10 +3022,8 @@ struct ib_mr *ocrdma_alloc_mr(struct ib_pd *ibpd,
 		return ERR_PTR(-ENOMEM);
 
 	mr->pages = kcalloc(max_num_sg, sizeof(*mr->pages), GFP_KERNEL);
-	if (!mr->pages) {
-		status = -ENOMEM;
+	if (!mr->pages)
 		goto pl_err;
-	}
 
 	status = ocrdma_get_pbl_info(dev, mr, max_num_sg);
 	if (status)
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1628856 — [PATCH v2 10/12] IB/ocrdma: Returning only value constants in ocrdma_resize_cq()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-22 17:00 +0200
Subject[PATCH v2 10/12] IB/ocrdma: Returning only value constants in ocrdma_resize_cq()
Message-ID<tz4FY-47X-17@gated-at.bofh.it>
In reply to#1628843
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 22 Apr 2017 15:15:09 +0200

Return constant integer values without storing them in the local
variable "status".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 2dc399eeeefd..60b8813aff42 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1122,15 +1122,12 @@ struct ib_cq *ocrdma_create_cq(struct ib_device *ibdev,
 int ocrdma_resize_cq(struct ib_cq *ibcq, int new_cnt,
 		     struct ib_udata *udata)
 {
-	int status = 0;
 	struct ocrdma_cq *cq = get_ocrdma_cq(ibcq);
 
-	if (new_cnt < 1 || new_cnt > cq->max_hw_cqe) {
-		status = -EINVAL;
-		return status;
-	}
+	if (new_cnt < 1 || new_cnt > cq->max_hw_cqe)
+		return -EINVAL;
 	ibcq->cqe = new_cnt;
-	return status;
+	return 0;
 }
 
 static void ocrdma_flush_cq(struct ocrdma_cq *cq)
-- 
2.12.2

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web