>> >> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c >> >> index 84c1897..2e29931 100644 >> >> --- a/drivers/usb/core/hub.c >> >> +++ b/drivers/usb/core/hub.c >> > >> >> @@ -1822,6 +1830,7 @@ int usb_new_device(struct usb_device *udev) >> >> * notifier chain (used by usbfs and possibly others). >> >> */ >> >> err = device_add(&udev->dev); >> >> + otg_notify(udev, USB_DEVICE_ADD); >> >> if (err) { >> >> dev_err(&udev->dev, "can't device_add, error %d\n", err); >> >> goto fail; >> > >> >I just noticed this. Do you really want to send the notification >> >message even when device_add() fails? It would make more sense to add >> >this after the "if" statement. >> > >> >> Thanks for you comment. >> >> The main purpose for otg_notify() function is that do notification to otg transceiver >driver who maintains the OTG state machine. >> For this case, otg_notify(udev, USB_DEVICE_ADD) notify USB device connect >(b_conn) event to otg transceiver driver. >> Even it is failed to device_add(), but it also needs such device connect event to make >sure OTG works in correct state according to spec. > >But if device_add() fails then you will never call otg_notify(udev, >USB_DEVICE_REMOVE). Is that really what you want? > Sorry for late response, you are correct, if device_add() fails, no USB_DEVICE_REMOVE notification got. Will resend patch with this fixed. Thanks for your comment. Hao -- 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