]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 16 Oct 2024 13:18:44 +0000 (16:18 +0300)
committerNiklas Cassel <cassel@kernel.org>
Thu, 17 Oct 2024 08:06:37 +0000 (10:06 +0200)
Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it
consistent with other similar helper implementations.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20241016131845.898632-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-scsi.c

index a4aedf7e177580efb459af29fc540508aef82324..c97fc8dc270d21c4bc68a14ea935e3651dcf5ea4 100644 (file)
@@ -1334,17 +1334,8 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
  */
 static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
 {
-       u64 lba = 0;
-       u32 len;
-
-       lba |= ((u64)(cdb[1] & 0x1f)) << 16;
-       lba |= ((u64)cdb[2]) << 8;
-       lba |= ((u64)cdb[3]);
-
-       len = cdb[4];
-
-       *plba = lba;
-       *plen = len;
+       *plba = get_unaligned_be24(&cdb[1]) & 0x1fffff;
+       *plen = cdb[4];
 }
 
 /**