lkml.org 
[lkml]   [2023]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3 RESEND 4/4] usb: core: add phy notify connect and disconnect
Date
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
\
 
 \ /
  Last update: 2023-12-07 11:45    [W:0.050 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site