summaryrefslogtreecommitdiff
path: root/drivers/ata
diff options
context:
space:
mode:
authorNiklas Cassel <niklas.cassel@wdc.com>2022-09-26 20:53:06 +0000
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-10-17 11:31:52 +0900
commit461ec040677127510d018c06e64d868e5e91be75 (patch)
tree7f61b5167e64abf6c597424c52d62e52dc50e6a2 /drivers/ata
parent7390896b3484d44cbdb8bc4859964314ac66d3c9 (diff)
ata: libata: clarify when ata_eh_request_sense() will be called
ata_eh_request_sense() returns early when flag ATA_QCFLAG_SENSE_VALID is set. However, since the call to ata_eh_request_sense() is guarded by a ATA_SENSE bit conditional, the logical conclusion for the reader is that all checks are performed at the call site. Highlight the fact that the sense data will not be fetched if flag ATA_QCFLAG_SENSE_VALID is already set by adding an additional check to the existing guarding conditional. No functional change. Additionally, add a comment explaining that ata_eh_analyze_tf() will only fetch the sense data if: -It was a non-NCQ command that failed, or -It was a NCQ command that failed, but the sense data was not included in the NCQ command error log (i.e. NCQ autosense is not supported). Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-eh.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 08e11bc312c2..70022bf91493 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1575,7 +1575,14 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc)
switch (qc->dev->class) {
case ATA_DEV_ZAC:
- if (stat & ATA_SENSE)
+ /*
+ * Fetch the sense data explicitly if:
+ * -It was a non-NCQ command that failed, or
+ * -It was a NCQ command that failed, but the sense data
+ * was not included in the NCQ command error log
+ * (i.e. NCQ autosense is not supported by the device).
+ */
+ if (!(qc->flags & ATA_QCFLAG_SENSE_VALID) && (stat & ATA_SENSE))
ata_eh_request_sense(qc);
fallthrough;
case ATA_DEV_ATA: