diff mbox

IB/mlx5: Remove dead code from alloc_cached_mr()

Message ID 1438033403-13129-1-git-send-email-roland@kernel.org (mailing list archive)
State Accepted
Headers show

Commit Message

Roland Dreier July 27, 2015, 9:43 p.m. UTC
From: Roland Dreier <roland@purestorage.com>

The only place that assigns mr inside the loop already does a break.
So "if (mr)" will never be true here since the function initializes mr
to NULL at the top.  We can just drop the extra if and break here.

Signed-off-by: Roland Dreier <roland@purestorage.com>
---
 drivers/infiniband/hw/mlx5/mr.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Eli Cohen July 27, 2015, 10:22 p.m. UTC | #1
Acked-by: Eli Cohen  <eli@mellanox.com>

> 
> From: Roland Dreier <roland@purestorage.com>
> 
> The only place that assigns mr inside the loop already does a break.
> So "if (mr)" will never be true here since the function initializes mr to NULL at the top.  We can just drop the extra if and break here.
> 
--
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
Doug Ledford July 28, 2015, 2:47 p.m. UTC | #2
On 07/27/2015 05:43 PM, Roland Dreier wrote:
> From: Roland Dreier <roland@purestorage.com>
> 
> The only place that assigns mr inside the loop already does a break.
> So "if (mr)" will never be true here since the function initializes mr
> to NULL at the top.  We can just drop the extra if and break here.
> 
> Signed-off-by: Roland Dreier <roland@purestorage.com>
> ---
>  drivers/infiniband/hw/mlx5/mr.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index bc9a0de897cb..10d2b213a4d8 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -441,9 +441,6 @@ static struct mlx5_ib_mr *alloc_cached_mr(struct mlx5_ib_dev *dev, int order)
>  		spin_unlock_irq(&ent->lock);
>  
>  		queue_work(cache->wq, &ent->work);
> -
> -		if (mr)
> -			break;
>  	}
>  
>  	if (!mr)
> 

Thanks Roland.  Picking this up for 4.3 today.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index bc9a0de897cb..10d2b213a4d8 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -441,9 +441,6 @@  static struct mlx5_ib_mr *alloc_cached_mr(struct mlx5_ib_dev *dev, int order)
 		spin_unlock_irq(&ent->lock);
 
 		queue_work(cache->wq, &ent->work);
-
-		if (mr)
-			break;
 	}
 
 	if (!mr)