From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com ([192.55.52.120]:15459 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964906AbcKXLEl (ORCPT ); Thu, 24 Nov 2016 06:04:41 -0500 From: Felipe Balbi To: Mathias Nyman , linux@roeck-us.net Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org Subject: Re: [RFT PATCH 1/1] xhci: free xhci virtual devices with leaf nodes first In-Reply-To: <5836B995.5010609@linux.intel.com> 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> Date: Thu, 24 Nov 2016 13:03:49 +0200 Message-ID: <87wpftp2ay.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: stable-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Mathias Nyman writes: >>> + /* are any devices using this tt_info? */ >>> + for (i =3D 1; i < HCS_MAX_SLOTS(xhci->hcs_params1); i++) { >> >> off-by-one here ? Why is i starting from 1? >> >>> + vdev =3D 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. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlg2yRUACgkQzL64meEa mQbmxw//X11YD61KVvCCC9c7VmieCVxrHrWJ9mM90Rk+GEXdgb2hoyjkaYFM2qSL W+d5UQ7TlyMedQkr1qj+sAiqM3QZPg7EIAbQMICxJfxiSXcUmMgEyyShPGr9SrYn +n+ZRbGrtBqj52XxFQAJwCiFLqs4OaXRxtW0Q+6Ro/78tdAHRfP3lmNq8T24QSob 1gxPhS5BubDpr7/coHCr7hm+FM2IW93fFaFjIQrqo5TkZJ+Ryqo9W88xKJv17Udy mjX+zValprZXfUwbt6PD57mFg+eOA0wrVazcw4NdZyG0nvVS+VSijJiS6ceAqpbx csuatabwdXu3k3dA/XnCY0jcLt5TzuAMGADMTTjJCzvX/kSj8kip4eYvJFxSl55K id7nBjK9YelvRy4jUvY3GuW2ByzzWyfz5bQuiifRFVEvA0Bb+4UC/RYKSwOopmh/ hFhSknXVQWyUphEzMBbfXAqkCFd5pOy/xwzS3FxFwwLCbEczxJCGGlkX1h5/ARDQ XymjEbKSySXN9UG3IbBO/cRBQfF8cy9r7WPlHQZKQKpWiKz9hXMJin+ekNj75XJ7 F9PqB7BpbaRXxiDz2TRVOI1TzRG8RS+iIKN8KiC0AQ3wJuDgkjEnbbFUxTia6qAJ FmeFhR/RFUlFqdUoTYS3/Y7xG5LYhgG5i8zDmEHhk7UWNyu28sc= =SMSm -----END PGP SIGNATURE----- --=-=-=--