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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 11, 2025 at 03:25:24PM +0200, Niklas Cassel wrote:
> 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@xxxxxxxxxx>
> ---
>  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]);

sense_valid is u64, should we update it to u32? We can also simplify
the sense_valid bit check to use the BIT() macro.

>  	extended_sense = get_unaligned_le16(&buf[14]);
>  	aux_icc_valid = extended_sense & BIT(15);
>  
> -- 
> 2.49.0
>

Thanks,
Igor




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux