public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stanley Chang[昌育德]" <stanley_chang@realtek.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Vinod Koul" <vkoul@kernel.org>,
	"Johan Hovold" <johan@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Rob Herring" <robh@kernel.org>,
	"Jinjie Ruan" <ruanjinjie@huawei.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Roy Luo" <royluo@google.com>,
	"Flavio Suligoi" <f.suligoi@asem.it>,
	"Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: [PATCH v3 RESEND 4/4] usb: core: add phy notify connect and disconnect
Date: Thu, 7 Dec 2023 10:43:54 +0000	[thread overview]
Message-ID: <6556cc86a350493fbf9f127cd558d76b@realtek.com> (raw)
In-Reply-To: <2023120730-mouth-jolt-0170@gregkh>

Hi Greg,

> > +int usb_phy_roothub_notify_connect(struct usb_phy_roothub
> > +*phy_roothub, int port) {
> > +     struct usb_phy_roothub *roothub_entry;
> > +     struct list_head *head;
> > +     int err;
> > +
> > +     if (!phy_roothub)
> > +             return 0;
> 
> How can phy_roothub ever be NULL?
> 
This is possible. If the host no use generic phy, then usb_phy_roothub_alloc will return NULL.
And other callbacks also follow this rule.

> > +
> > +     head = &phy_roothub->list;
> > +
> > +     list_for_each_entry(roothub_entry, head, list) {
> > +             err = phy_notify_connect(roothub_entry->phy, port);
> > +             if (err)
> > +                     return err;
> > +     }
> >
> 
> You walk a list with no locking at all?  That does not seem right at all.

The lock seems unnecessary.
And other similar APIs also don't use any locks.

> Also, this is a new function that is exported with no documentation?
> Please fix.
> 
Okay, I will add.

Thanks,
Stanley

  reply	other threads:[~2023-12-07 10:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  7:38 [PATCH v3 RESEND 1/4] phy: core: add notify_connect and notify_disconnect callback Stanley Chang
2023-12-07  7:38 ` [PATCH v3 RESEND 2/4] phy: realtek: usb: add new driver for the Realtek RTD SoC USB 2.0 PHY Stanley Chang
2023-12-07  7:38 ` [PATCH v3 RESEND 3/4] phy: realtek: usb: add new driver for the Realtek RTD SoC USB 3.0 PHY Stanley Chang
2023-12-07  7:38 ` [PATCH v3 RESEND 4/4] usb: core: add phy notify connect and disconnect Stanley Chang
2023-12-07 10:08   ` Greg Kroah-Hartman
2023-12-07 10:43     ` Stanley Chang[昌育德] [this message]
2023-12-07  8:54 ` [PATCH v3 RESEND 1/4] phy: core: add notify_connect and notify_disconnect callback Sergei Shtylyov
2023-12-07  9:34   ` Stanley Chang[昌育德]
2023-12-07 10:02 ` Greg Kroah-Hartman
2023-12-07 10:28   ` Stanley Chang[昌育德]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6556cc86a350493fbf9f127cd558d76b@realtek.com \
    --to=stanley_chang@realtek.com \
    --cc=f.suligoi@asem.it \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johan@kernel.org \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ricardo.canuelo@collabora.com \
    --cc=robh@kernel.org \
    --cc=royluo@google.com \
    --cc=ruanjinjie@huawei.com \
    --cc=stern@rowland.harvard.edu \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox