All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: use standard block status symbolic names to check return value
@ 2020-07-08  2:18 ` Baolin Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Baolin Wang @ 2020-07-08  2:18 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: baolin.wang, baolin.wang7, linux-nvme, linux-kernel

It's better to use the same symbol as the return to check return value,
and will always work in the unlikely event that the defines are reordered.

Suggested-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 drivers/nvme/host/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 1ac0717..45cb59c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -873,18 +873,18 @@ static blk_status_t nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
 		return BLK_STS_IOERR;
 
 	ret = nvme_setup_cmd(ns, req, &cmnd);
-	if (ret)
+	if (ret != BLK_STS_OK)
 		return ret;
 
 	if (blk_rq_nr_phys_segments(req)) {
 		ret = nvme_map_data(dev, req, &cmnd);
-		if (ret)
+		if (ret != BLK_STS_OK)
 			goto out_free_cmd;
 	}
 
 	if (blk_integrity_rq(req)) {
 		ret = nvme_map_metadata(dev, req, &cmnd);
-		if (ret)
+		if (ret != BLK_STS_OK)
 			goto out_unmap_data;
 	}
 
-- 
1.8.3.1


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

* [PATCH] nvme-pci: use standard block status symbolic names to check return value
@ 2020-07-08  2:18 ` Baolin Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Baolin Wang @ 2020-07-08  2:18 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: baolin.wang7, linux-nvme, baolin.wang, linux-kernel

It's better to use the same symbol as the return to check return value,
and will always work in the unlikely event that the defines are reordered.

Suggested-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 drivers/nvme/host/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 1ac0717..45cb59c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -873,18 +873,18 @@ static blk_status_t nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
 		return BLK_STS_IOERR;
 
 	ret = nvme_setup_cmd(ns, req, &cmnd);
-	if (ret)
+	if (ret != BLK_STS_OK)
 		return ret;
 
 	if (blk_rq_nr_phys_segments(req)) {
 		ret = nvme_map_data(dev, req, &cmnd);
-		if (ret)
+		if (ret != BLK_STS_OK)
 			goto out_free_cmd;
 	}
 
 	if (blk_integrity_rq(req)) {
 		ret = nvme_map_metadata(dev, req, &cmnd);
-		if (ret)
+		if (ret != BLK_STS_OK)
 			goto out_unmap_data;
 	}
 
-- 
1.8.3.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme-pci: use standard block status symbolic names to check return value
  2020-07-08  2:18 ` Baolin Wang
@ 2020-07-08  5:09   ` Christoph Hellwig
  -1 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-07-08  5:09 UTC (permalink / raw)
  To: Baolin Wang
  Cc: kbusch, axboe, hch, sagi, baolin.wang7, linux-nvme, linux-kernel

On Wed, Jul 08, 2020 at 10:18:01AM +0800, Baolin Wang wrote:
> It's better to use the same symbol as the return to check return value,
> and will always work in the unlikely event that the defines are reordered.
> 
> Suggested-by: Keith Busch <kbusch@kernel.org>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>

I'm really not sure this is worth it.  When designing the blk_status_t
type keeping 0 as was a deliberate design decision. 

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

* Re: [PATCH] nvme-pci: use standard block status symbolic names to check return value
@ 2020-07-08  5:09   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-07-08  5:09 UTC (permalink / raw)
  To: Baolin Wang
  Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, kbusch, hch

On Wed, Jul 08, 2020 at 10:18:01AM +0800, Baolin Wang wrote:
> It's better to use the same symbol as the return to check return value,
> and will always work in the unlikely event that the defines are reordered.
> 
> Suggested-by: Keith Busch <kbusch@kernel.org>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>

I'm really not sure this is worth it.  When designing the blk_status_t
type keeping 0 as was a deliberate design decision. 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme-pci: use standard block status symbolic names to check return value
  2020-07-08  5:09   ` Christoph Hellwig
@ 2020-07-08  6:17     ` Baolin Wang
  -1 siblings, 0 replies; 6+ messages in thread
From: Baolin Wang @ 2020-07-08  6:17 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: kbusch, axboe, sagi, baolin.wang7, linux-nvme, linux-kernel

On Wed, Jul 08, 2020 at 07:09:00AM +0200, Christoph Hellwig wrote:
> On Wed, Jul 08, 2020 at 10:18:01AM +0800, Baolin Wang wrote:
> > It's better to use the same symbol as the return to check return value,
> > and will always work in the unlikely event that the defines are reordered.
> > 
> > Suggested-by: Keith Busch <kbusch@kernel.org>
> > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> 
> I'm really not sure this is worth it.  When designing the blk_status_t
> type keeping 0 as was a deliberate design decision.

OK. But there are some places use the BLK_STS_OK to validate, and some
places not in this driver, so I think we should keep code consistent?


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

* Re: [PATCH] nvme-pci: use standard block status symbolic names to check return value
@ 2020-07-08  6:17     ` Baolin Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Baolin Wang @ 2020-07-08  6:17 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, kbusch

On Wed, Jul 08, 2020 at 07:09:00AM +0200, Christoph Hellwig wrote:
> On Wed, Jul 08, 2020 at 10:18:01AM +0800, Baolin Wang wrote:
> > It's better to use the same symbol as the return to check return value,
> > and will always work in the unlikely event that the defines are reordered.
> > 
> > Suggested-by: Keith Busch <kbusch@kernel.org>
> > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> 
> I'm really not sure this is worth it.  When designing the blk_status_t
> type keeping 0 as was a deliberate design decision.

OK. But there are some places use the BLK_STS_OK to validate, and some
places not in this driver, so I think we should keep code consistent?


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2020-07-08  6:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08  2:18 [PATCH] nvme-pci: use standard block status symbolic names to check return value Baolin Wang
2020-07-08  2:18 ` Baolin Wang
2020-07-08  5:09 ` Christoph Hellwig
2020-07-08  5:09   ` Christoph Hellwig
2020-07-08  6:17   ` Baolin Wang
2020-07-08  6:17     ` Baolin Wang

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.