Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] null_blk: Fix zoned command return code
@ 2019-10-09 15:38 kbusch
  2019-10-10  2:59 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: kbusch @ 2019-10-09 15:38 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: Keith Busch, Chaitanya Kulkarni

From: Keith Busch <kbusch@kernel.org>

The return code from null_handle_zoned() sets the cmd->error value. Returning
OK status when an error occured overwrites the intended cmd->error. Return the
appropriate error code instead of setting the error in the cmd.

Fixes: fceb5d1b19cbe626 ("null_blk: create a helper for zoned devices")
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/block/null_blk_zoned.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
index eabc116832a7..3d7fdea872f8 100644
--- a/drivers/block/null_blk_zoned.c
+++ b/drivers/block/null_blk_zoned.c
@@ -142,8 +142,7 @@ static blk_status_t null_zone_reset(struct nullb_cmd *cmd, sector_t sector)
 		zone->wp = zone->start;
 		break;
 	default:
-		cmd->error = BLK_STS_NOTSUPP;
-		break;
+		return BLK_STS_NOTSUPP;
 	}
 	return BLK_STS_OK;
 }
-- 
2.21.0


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

* Re: [PATCH] null_blk: Fix zoned command return code
  2019-10-09 15:38 [PATCH] null_blk: Fix zoned command return code kbusch
@ 2019-10-10  2:59 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-10-10  2:59 UTC (permalink / raw)
  To: kbusch, linux-block; +Cc: Chaitanya Kulkarni

On 10/9/19 9:38 AM, kbusch@kernel.org wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> The return code from null_handle_zoned() sets the cmd->error value. Returning
> OK status when an error occured overwrites the intended cmd->error. Return the
> appropriate error code instead of setting the error in the cmd.

Applied, thanks.

-- 
Jens Axboe


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 15:38 [PATCH] null_blk: Fix zoned command return code kbusch
2019-10-10  2:59 ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox