RE: [PATCH v3 RESEND 4/4] usb: core: add phy notify connect and disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux