[PATCH 2/2] ata: libata-sata: Simplify sense_valid fetching

Niklas Cassel
2025-04-11T13:25:36Z

While the sense_valid field is 47 bits according to the specification,
we are currently only fetching 32 bits, because these are the only
bits that represent the tags (0-31), which is all we care about.

Thus, replace the existing logic with a simple get_unaligned_le32().

Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
drivers/ata/libata-sata.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 2e4463d3a356..5ba79a1053ea 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -1529,8 +1529,7 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
return -EIO;
}

- sense_valid = (u64)buf[8] | ((u64)buf[9] << 8) |
- ((u64)buf[10] << 16) | ((u64)buf[11] << 24);
+ sense_valid = get_unaligned_le32(&buf[8]);
extended_sense = get_unaligned_le16(&buf[14]);
aux_icc_valid = extended_sense & BIT(15);

--
2.49.0