Re: [PATCH 2/5] usb: move struct usb_device->children to struct usb_hub_port->child

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

 



On Thu, 29 Mar 2012, Lan Tianyu wrote:

> >> @@ -1475,11 +1477,12 @@ bool usb_device_is_owned(struct usb_device *udev)
> >>
> >>   static void recursively_mark_NOTATTACHED(struct usb_device *udev)
> >>   {
> >> +	struct usb_hub	*hub = hdev_to_hub(udev);
> >
> > I'm not sure this is good.  You are calling hdev_to_hub without knowing
> > beforehand that udev really is a hub -- in fact, most of the time udev
> > won't be a hub.  The routine wasn't meant to be used that way.  Have
> > you checked that hdev_to_hub won't crash when the argument isn't a hub?
> > What happens if the active configuration has no interfaces?
> About this, I have an idea to add a check of hdev->maxchild. I have
> verified that hdev->maxchild only is set in the hub_configure() and
> hub_disconnect(). So we can identify whether the udev is a usb hub or
> not through hdev->maxchild. Does this make sense?

Yes, okay.  If you add such a check to hdev_to_hub() then it will work 
properly.  Unless somebody markets a hub with no ports -- but we don't 
need to worry about that!  :-)

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux