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


Groups > linux.kernel > #1441247 > unrolled thread

[PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()

Started byweiyj_lk@163.com
First post2016-07-12 13:10 +0200
Last post2016-07-13 12:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request() weiyj_lk@163.com - 2016-07-12 13:10 +0200
    Re: [PATCH -next] nvme-rdma: fix the return value of  nvme_rdma_reinit_request() J Freyensee <james_p_freyensee@linux.intel.com> - 2016-07-12 16:20 +0200
    Re: [PATCH -next] nvme-rdma: fix the return value of  nvme_rdma_reinit_request() Sagi Grimberg <sagi@grimberg.me> - 2016-07-13 12:40 +0200

#1441247 — [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()

Fromweiyj_lk@163.com
Date2016-07-12 13:10 +0200
Subject[PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
Message-ID<rU3JD-44Q-3@gated-at.bofh.it>
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

PTR_ERR should be applied before its argument is reassigned, otherwise the
return value will be set to 0, not error code.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/nvme/host/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 278551b..5208f16 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -299,8 +299,8 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq)
 	req->mr = ib_alloc_mr(dev->pd, IB_MR_TYPE_MEM_REG,
 			ctrl->max_fr_pages);
 	if (IS_ERR(req->mr)) {
-		req->mr = NULL;
 		ret = PTR_ERR(req->mr);
+		req->mr = NULL;
 	}
 
 	req->need_inval = false;

[toc] | [next] | [standalone]


#1441390 — Re: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()

FromJ Freyensee <james_p_freyensee@linux.intel.com>
Date2016-07-12 16:20 +0200
SubjectRe: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
Message-ID<rU6Hv-62T-11@gated-at.bofh.it>
In reply to#1441247
On Tue, 2016-07-12 at 11:06 +0000, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> PTR_ERR should be applied before its argument is reassigned,
> otherwise the
> return value will be set to 0, not error code.

Another good catch.

Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com>

> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

>  	if (IS_ERR(req->mr)) {
> -		req->mr = NULL;
>  		ret = PTR_ERR(req->mr);
> +		req->mr = NULL;
>  	}

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


#1442322 — Re: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()

FromSagi Grimberg <sagi@grimberg.me>
Date2016-07-13 12:40 +0200
SubjectRe: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
Message-ID<rUpKb-1QV-35@gated-at.bofh.it>
In reply to#1441247
Thanks!

Reviewed-by: Sagi Grimberg <sagi@grimerg.me>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web