Re: [RFT PATCH 1/1] xhci: free xhci virtual devices with leaf nodes first

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

 



Hi,

Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> writes:
>>> +			/* are any devices using this tt_info? */
>>> +			for (i = 1; i < HCS_MAX_SLOTS(xhci->hcs_params1); i++) {
>>
>> off-by-one here ? Why is i starting from 1?
>>
>>> +				vdev = xhci->devs[i];
>
> slit_id 0 is reserved and xhci->devs[0] is not used, so ne need to
> check it.

hmm... it's reserved for the HW, sure. Do you need to over allocate the
array by 1 just to keep this first member unused? Couldn't you handle
the +1/-1 (depending on the case) in xhci driver itself? Saves a bit of
memory there.

> All other places that check xhci->devs[0] are avtually buggy

fair enough, sounds like an accessor guaranteeing the 'rules of
engagement' for this would be useful.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]