The function should never be called with cmnd NULL so put a fat WARN there. Fix also smatch wraning: schedule_resp() warn: variable dereferenced before check 'cmnd' Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx> --- drivers/scsi/scsi_debug.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index ccbe1282e975..f032aac75997 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3947,11 +3947,18 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, struct sdebug_queued_cmd *sqcp = NULL; struct scsi_device *sdp = cmnd->device; - if (NULL == cmnd || NULL == devip) { - pr_warn("called with NULL cmnd or devip pointer\n"); + /* this should never happend */ + if (WARN_ON(!cmnd)) + return SCSI_MLQUEUE_HOST_BUSY; + + if (NULL == devip) { + pr_warn("called devip == NULL\n"); /* no particularly good error to report back */ return SCSI_MLQUEUE_HOST_BUSY; } + + sdp = cmnd->device; + if ((scsi_result) && (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)) sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n", __func__, scsi_result); -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html