diff options
author | Damien Le Moal | 2022-01-25 10:21:25 +0900 |
---|---|---|
committer | Damien Le Moal | 2022-01-31 09:58:32 +0900 |
commit | 261e150799305e546753554babccab83a0d50627 (patch) | |
tree | 7142b0f3d5722b9c87f62327f837f25195410263 /drivers/ata | |
parent | 7fdbacfad7c8c3c268bd86be6dee676d4eec8bc0 (diff) |
ata: libata-scsi: Simplify ata_scsi_mode_select_xlat()
Use get_unaligned_be16() instead of using hardcoded accesses to
16-bits big endian cdb fields.
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-scsi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index c73e94c06147..515c5599cece 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3672,7 +3672,7 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) goto invalid_fld; } - len = (cdb[7] << 8) + cdb[8]; + len = get_unaligned_be16(&cdb[7]); hdr_len = 8; } @@ -3698,7 +3698,7 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) if (six_byte) bd_len = p[3]; else - bd_len = (p[6] << 8) + p[7]; + bd_len = get_unaligned_be16(&p[6]); len -= hdr_len; p += hdr_len; @@ -3722,7 +3722,7 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) goto invalid_param_len; spg = p[1]; - pg_len = (p[2] << 8) | p[3]; + pg_len = get_unaligned_be16(&p[2]); p += 4; len -= 4; } else { |