From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com ([134.134.136.100]:45017 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756702AbcKXMHd (ORCPT ); Thu, 24 Nov 2016 07:07:33 -0500 Subject: Re: [RFT PATCH 1/1] xhci: free xhci virtual devices with leaf nodes first To: Felipe Balbi , linux@roeck-us.net References: <582DC88C.5040308@linux.intel.com> <1479903867-561-1-git-send-email-mathias.nyman@linux.intel.com> <8760ndqmhm.fsf@linux.intel.com> <5836B995.5010609@linux.intel.com> <87wpftp2ay.fsf@linux.intel.com> Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org From: Mathias Nyman Message-ID: <5836D80A.7010004@linux.intel.com> Date: Thu, 24 Nov 2016 14:07:38 +0200 MIME-Version: 1.0 In-Reply-To: <87wpftp2ay.fsf@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 24.11.2016 13:03, Felipe Balbi wrote: > > Hi, > > Mathias Nyman 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. > There are many things that needs fixing in this area, but not in this patch -Mathias