[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdf65c4eca9b420bb1ed29edb66482fb@realtek.com>
Date: Fri, 21 Apr 2023 08:40:05 +0000
From: Stanley Chang[昌育德] <stanley_chang@...ltek.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Alan Stern <stern@...land.harvard.edu>,
Douglas Anderson <dianders@...omium.org>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Bhuvanesh Surachari <Bhuvanesh_Surachari@...tor.com>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Flavio Suligoi <f.suligoi@...m.it>,
Ray Chi <raychi@...gle.com>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v1] usb: phy: add usb phy notify port status API
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index
> > 97a0f8faea6e..b4fbbeae1927 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -614,6 +614,19 @@ static int hub_ext_port_status(struct usb_hub *hub,
> int port1, int type,
> > ret = 0;
> > }
> > mutex_unlock(&hub->status_mutex);
> > +
> > + if (!ret) {
> > + struct usb_device *hdev = hub->hdev;
> > +
> > + if (hdev && !hdev->parent) {
>
> How can you have a device without a parent? And why does it matter?
If the hub is a root hub, the parent of hub will be NULL.
And we only send the port status to phy driver for root hub.
>
> And how could hdev be NULL? And if it can change to be NULL, what prevents
> it from changing right after you checked for it?
>
It is right. hdev is never NULL, this is a redundant check.
Thanks,
Stanley
Powered by blists - more mailing lists