Commit c7f4c5de authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: aic79xx: Fix up NULL command in ahd_done()

Found by smatch.

Fixes: c67e6380 ("scsi: aic79xx: Do not reference SCSI command when resetting device")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20231023073014.21438-1-hare@suse.deSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4b1c0791
......@@ -1834,7 +1834,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
} else {
ahd_set_transaction_status(scb, CAM_REQ_CMP);
}
} else if (ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {
} else if (cmd &&
ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {
ahd_linux_handle_scsi_status(ahd, cmd->device, scb);
}
......@@ -1868,7 +1869,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
}
ahd_free_scb(ahd, scb);
ahd_linux_queue_cmd_complete(ahd, cmd);
if (cmd)
ahd_linux_queue_cmd_complete(ahd, cmd);
}
static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment