diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 9179f1123213857a882eb5302bdd5cd843188d55..665fd2b189701fe53047da6369db2a36a35de656 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2481,8 +2481,6 @@ static void ata_eh_link_report(struct ata_link *link) for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; - const u8 *cdb = qc->cdb; - size_t cdb_len = qc->dev->cdb_len; char data_buf[20] = ""; char cdb_buf[70] = ""; @@ -2510,6 +2508,9 @@ static void ata_eh_link_report(struct ata_link *link) } if (ata_is_atapi(qc->tf.protocol)) { + const u8 *cdb = qc->cdb; + size_t cdb_len = qc->dev->cdb_len; + if (qc->scsicmd) { cdb = qc->scsicmd->cmnd; cdb_len = qc->scsicmd->cmd_len;