All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
@ 2016-07-12 11:06 ` weiyj_lk
  0 siblings, 0 replies; 8+ messages in thread
From: weiyj_lk @ 2016-07-12 11:06 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig
  Cc: Wei Yongjun, linux-nvme, linux-kernel

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;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
@ 2016-07-12 11:06 ` weiyj_lk
  0 siblings, 0 replies; 8+ messages in thread
From: weiyj_lk @ 2016-07-12 11:06 UTC (permalink / raw)


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 at 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;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
  2016-07-12 11:06 ` weiyj_lk
@ 2016-07-12 14:18   ` J Freyensee
  -1 siblings, 0 replies; 8+ messages in thread
From: J Freyensee @ 2016-07-12 14:18 UTC (permalink / raw)
  To: weiyj_lk, Keith Busch, Jens Axboe, Christoph Hellwig
  Cc: Wei Yongjun, linux-kernel, linux-nvme

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;
>  	}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
@ 2016-07-12 14:18   ` J Freyensee
  0 siblings, 0 replies; 8+ messages in thread
From: J Freyensee @ 2016-07-12 14:18 UTC (permalink / raw)


On Tue, 2016-07-12@11:06 +0000, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei at 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 at linux.intel.com>

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
  2016-07-12 11:06 ` weiyj_lk
@ 2016-07-12 15:27   ` Jens Axboe
  -1 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2016-07-12 15:27 UTC (permalink / raw)
  To: weiyj_lk, Keith Busch, Christoph Hellwig
  Cc: Wei Yongjun, linux-nvme, linux-kernel

On 07/12/2016 04:06 AM, 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.

Applied, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
@ 2016-07-12 15:27   ` Jens Axboe
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2016-07-12 15:27 UTC (permalink / raw)


On 07/12/2016 04:06 AM, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei at 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.

Applied, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
  2016-07-12 11:06 ` weiyj_lk
@ 2016-07-13 10:36   ` Sagi Grimberg
  -1 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2016-07-13 10:36 UTC (permalink / raw)
  To: weiyj_lk, Keith Busch, Jens Axboe, Christoph Hellwig
  Cc: Wei Yongjun, linux-kernel, linux-nvme

Thanks!

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request()
@ 2016-07-13 10:36   ` Sagi Grimberg
  0 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2016-07-13 10:36 UTC (permalink / raw)


Thanks!

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-07-13 10:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-12 11:06 [PATCH -next] nvme-rdma: fix the return value of nvme_rdma_reinit_request() weiyj_lk
2016-07-12 11:06 ` weiyj_lk
2016-07-12 14:18 ` J Freyensee
2016-07-12 14:18   ` J Freyensee
2016-07-12 15:27 ` Jens Axboe
2016-07-12 15:27   ` Jens Axboe
2016-07-13 10:36 ` Sagi Grimberg
2016-07-13 10:36   ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.