diff mbox

[1/1] IB/rxe: avoid unnecessary NULL check

Message ID 1528969542-19870-1-git-send-email-yanjun.zhu@oracle.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Zhu Yanjun June 14, 2018, 9:45 a.m. UTC
Before goto err2, the variable qp is checked. So it is not necessary
to check qp in label err2.

Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
 drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Leon Romanovsky June 14, 2018, 10:39 a.m. UTC | #1
On Thu, Jun 14, 2018 at 05:45:42AM -0400, Zhu Yanjun wrote:
> Before goto err2, the variable qp is checked. So it is not necessary
> to check qp in label err2.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Yuval Shaia June 14, 2018, 12:52 p.m. UTC | #2
On Thu, Jun 14, 2018 at 05:45:42AM -0400, Yanjun Zhu wrote:
> Before goto err2, the variable qp is checked. So it is not necessary
> to check qp in label err2.
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
> index dfba44a..b0c8d1e 100644
> --- a/drivers/infiniband/sw/rxe/rxe_recv.c
> +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
> @@ -256,8 +256,7 @@ static int hdr_check(struct rxe_pkt_info *pkt)
>  	return 0;
>  
>  err2:
> -	if (qp)
> -		rxe_drop_ref(qp);
> +	rxe_drop_ref(qp);

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

>  err1:
>  	return -EINVAL;
>  }
> -- 
> 2.7.4
> 
> --
> 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
--
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
Jason Gunthorpe June 18, 2018, 7:37 p.m. UTC | #3
On Thu, Jun 14, 2018 at 05:45:42AM -0400, Zhu Yanjun wrote:
> Before goto err2, the variable qp is checked. So it is not necessary
> to check qp in label err2.
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied to for-next

Thanks,
Jason
--
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
diff mbox

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
index dfba44a..b0c8d1e 100644
--- a/drivers/infiniband/sw/rxe/rxe_recv.c
+++ b/drivers/infiniband/sw/rxe/rxe_recv.c
@@ -256,8 +256,7 @@  static int hdr_check(struct rxe_pkt_info *pkt)
 	return 0;
 
 err2:
-	if (qp)
-		rxe_drop_ref(qp);
+	rxe_drop_ref(qp);
 err1:
 	return -EINVAL;
 }