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


Groups > linux.kernel > #1595180 > unrolled thread

[PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-03-08 14:40 +0100
Last post2017-03-09 13:00 +0100
Articles 3 — 3 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 24/26] IB/ocrdma: One jump label less in  ocrdma_alloc_ucontext_pd() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-03-08 14:40 +0100
    Re: [PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd() Devesh Sharma <devesh.sharma@broadcom.com> - 2017-03-08 16:20 +0100
    Re: [PATCH 24/26] IB/ocrdma: One jump label less in  ocrdma_alloc_ucontext_pd() Yuval Shaia <yuval.shaia@oracle.com> - 2017-03-09 13:00 +0100

#1595180 — [PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-03-08 14:40 +0100
Subject[PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()
Message-ID<tiJYR-7cO-13@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Mar 2017 11:11:35 +0100

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>
---
 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 ae0d343d1731..d3cb8e2f099f 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.0

[toc] | [next] | [standalone]


#1595262 — Re: [PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()

FromDevesh Sharma <devesh.sharma@broadcom.com>
Date2017-03-08 16:20 +0100
SubjectRe: [PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()
Message-ID<tiLxF-8ng-31@gated-at.bofh.it>
In reply to#1595180
Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>

On Wed, Mar 8, 2017 at 7:00 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 Mar 2017 11:11:35 +0100
>
> 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>
> ---
>  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 ae0d343d1731..d3cb8e2f099f 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.0
>

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


#1595982

FromYuval Shaia <yuval.shaia@oracle.com>
Date2017-03-09 13:00 +0100
Message-ID<tj4TE-4Fc-25@gated-at.bofh.it>
In reply to#1595180
On Wed, Mar 08, 2017 at 02:30:18PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 Mar 2017 11:11:35 +0100
> 
> 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>
> ---
>  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 ae0d343d1731..d3cb8e2f099f 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;
>  }

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

>  
>  static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx)
> -- 
> 2.12.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web