Skip to content

Commit 08b64ee

Browse files
andy-shevfloatious
authored andcommitted
ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
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 <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
1 parent 2d910fe commit 08b64ee

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/ata/libata-scsi.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,17 +1334,8 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
13341334
*/
13351335
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
13361336
{
1337-
u64 lba = 0;
1338-
u32 len;
1339-
1340-
lba |= ((u64)(cdb[1] & 0x1f)) << 16;
1341-
lba |= ((u64)cdb[2]) << 8;
1342-
lba |= ((u64)cdb[3]);
1343-
1344-
len = cdb[4];
1345-
1346-
*plba = lba;
1347-
*plen = len;
1337+
*plba = get_unaligned_be24(&cdb[1]) & 0x1fffff;
1338+
*plen = cdb[4];
13481339
}
13491340

13501341
/**

0 commit comments

Comments
 (0)