summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-06-23 06:22:20 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2018-06-26 12:27:06 -0400
commit8e1695a07c7b28e2eb1c02cc01e2b8f5dd28bf87 (patch)
treebea4b7856a3048aa566fcb190dfed5bc6b094458
parent0d437906f6dca6167b37c8e1f6f6ec395bde6230 (diff)
scsi: core: scsi_io_completion convert BUGs to WARNs
The scsi_io_completion function contains three BUG() and BUG_ON() calls. Replace them with WARN variants. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/scsi_lib.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 19ed11abe886..252edd61a688 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1060,13 +1060,21 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
1060 scsi_req(req->next_rq)->resid_len = scsi_in(cmd)->resid; 1060 scsi_req(req->next_rq)->resid_len = scsi_in(cmd)->resid;
1061 if (scsi_end_request(req, BLK_STS_OK, blk_rq_bytes(req), 1061 if (scsi_end_request(req, BLK_STS_OK, blk_rq_bytes(req),
1062 blk_rq_bytes(req->next_rq))) 1062 blk_rq_bytes(req->next_rq)))
1063 BUG(); 1063 WARN_ONCE(true,
1064 "Bidi command with remaining bytes");
1064 return; 1065 return;
1065 } 1066 }
1066 } 1067 }
1067 1068
1068 /* no bidi support yet, other than in pass-through */ 1069 /* no bidi support yet, other than in pass-through */
1069 BUG_ON(blk_bidi_rq(req)); 1070 if (unlikely(blk_bidi_rq(req))) {
1071 WARN_ONCE(true, "Only support bidi command in passthrough");
1072 scmd_printk(KERN_ERR, cmd, "Killing bidi command\n");
1073 if (scsi_end_request(req, BLK_STS_IOERR, blk_rq_bytes(req),
1074 blk_rq_bytes(req->next_rq)))
1075 WARN_ONCE(true, "Bidi command with remaining bytes");
1076 return;
1077 }
1070 1078
1071 /* 1079 /*
1072 * Next deal with any sectors which we were able to correctly 1080 * Next deal with any sectors which we were able to correctly
@@ -1089,7 +1097,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
1089 /* Kill remainder if no retries. */ 1097 /* Kill remainder if no retries. */
1090 if (unlikely(blk_stat && scsi_noretry_cmd(cmd))) { 1098 if (unlikely(blk_stat && scsi_noretry_cmd(cmd))) {
1091 if (scsi_end_request(req, blk_stat, blk_rq_bytes(req), 0)) 1099 if (scsi_end_request(req, blk_stat, blk_rq_bytes(req), 0))
1092 BUG(); 1100 WARN_ONCE(true,
1101 "Bytes remaining after failed, no-retry command");
1093 return; 1102 return;
1094 } 1103 }
1095 1104