Skip to content

Commit e7661a8

Browse files
Johannes Thumshirnmartinkpetersen
authored andcommitted
scsi: return correct blkprep status code in case scsi_init_io() fails.
When instrumenting the SCSI layer to run into the !blk_rq_nr_phys_segments(rq) case the following warning emitted from the block layer: blk_peek_request: bad return=-22 This happens because since commit fd3fc0b ("scsi: don't BUG_ON() empty DMA transfers") we return the wrong error value from scsi_prep_fn() back to the block layer. [mkp: silenced checkpatch] Signed-off-by: Johannes Thumshirn <[email protected]> Fixes: fd3fc0b scsi: don't BUG_ON() empty DMA transfers Cc: <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 785a470 commit e7661a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,10 @@ int scsi_init_io(struct scsi_cmnd *cmd)
10611061
struct scsi_device *sdev = cmd->device;
10621062
struct request *rq = cmd->request;
10631063
bool is_mq = (rq->mq_ctx != NULL);
1064-
int error;
1064+
int error = BLKPREP_KILL;
10651065

10661066
if (WARN_ON_ONCE(!blk_rq_nr_phys_segments(rq)))
1067-
return -EINVAL;
1067+
goto err_exit;
10681068

10691069
error = scsi_init_sgtable(rq, &cmd->sdb);
10701070
if (error)

0 commit comments

Comments
 (0)