Avoid that this function crashes if mcmd == NULL. Cc: Himanshu Madhani <hmadhani@xxxxxxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- drivers/scsi/qla2xxx/qla_target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index d25c3fa43601..cc0c99b5f3fb 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -5731,7 +5731,7 @@ static void qlt_handle_abts_completion(struct scsi_qla_host *vha, entry->error_subcode2); ha->tgt.tgt_ops->free_mcmd(mcmd); } - } else { + } else if (mcmd) { ha->tgt.tgt_ops->free_mcmd(mcmd); } } -- 2.22.0