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

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

 



On Tue, Apr 15, 2025 at 08:51:46AM +0200, Hannes Reinecke wrote:
> On 4/11/25 15:25, 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]);
> >   	extended_sense = get_unaligned_le16(&buf[14]);
> >   	aux_icc_valid = extended_sense & BIT(15);
> 
> Description is ever so misleading; we never fetched 47 bits to start
> with. All we do is simplify the logic.
> But whatever.

IMO, that is exactly what I wrote :)

Nevertheless, I clarified the commit message in V2.


Kind regards,
Niklas




[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