From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id A8480158A23 for ; Tue, 25 Jun 2024 16:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.131.102.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719334344; cv=none; b=YxfwDrer0NyjwV53b7gSWMAv6pjjYIjhGg0CWIoOVP9tie+15QvPo2RbGNa7DZZ6vbyojkkqHMWUyXjuTCWK2gX/5N277jIoexGYbXeUAbyLDXnChOJMQLwD/CB9P77uBZxA3U7+XqasdLxEp+ns8a7ZCSGp5WHQhV8BeaHgBJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719334344; c=relaxed/simple; bh=CSkW4GMifJtkp9xz07k19QprzyRVz89dbqnmMWY9NrI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ejB0r1Mp54KV1EZnAMeybcBNfh0ZPYyNqNxamKytpkZ1+un/LMgNpIYm746Ckg9bH4YNVa+G8myz3uBdv03g+v3zqdI5w+L2bVIx615N+KShU73ArR/ruEa1afL3I+8WQFfEqrHTsxw2ObERhYcfcA+XQs7hcrYfAZH+RTLTv7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu; spf=pass smtp.mailfrom=netrider.rowland.org; arc=none smtp.client-ip=192.131.102.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 672975 invoked by uid 1000); 25 Jun 2024 12:52:21 -0400 Date: Tue, 25 Jun 2024 12:52:21 -0400 From: Alan Stern To: Lizhe Cc: gregkh@linuxfoundation.org, hgajjar@de.adit-jv.com, stanley_chang@realtek.com, ricardo.canuelo@collabora.com, johan+linaro@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: hub:no need to obtain usb device Message-ID: References: <20240625164607.3367-1-sensor1010@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240625164607.3367-1-sensor1010@163.com> On Tue, Jun 25, 2024 at 09:46:07AM -0700, Lizhe wrote: > the usb device connected to the port has obtained. > there is no need to obtain it again. > > Signed-off-by: Lizhe > --- > drivers/usb/core/hub.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 4b93c0bd1d4b..f37b991fa86a 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -5358,7 +5358,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, > if (udev) { > if (hcd->usb_phy && !hdev->parent) > usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); > - usb_disconnect(&port_dev->child); > + usb_disconnect(&udev); > } This is wrong. We need to pass the address of port_dev->child, not the address of udev. This is so that usb_disconnect() can set port_dev->child to NULL. Setting udev to NULL instead won't work right. Alan Stern