On Thu, 14 Apr 2011, Sebastian Andrzej Siewior wrote: > the_controller is allocated in dummy_hcd_probe() and is NULL if the > allocation failed. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > --- > drivers/usb/gadget/dummy_hcd.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c > index 901b644..82ad9a7 100644 > --- a/drivers/usb/gadget/dummy_hcd.c > +++ b/drivers/usb/gadget/dummy_hcd.c > @@ -2349,6 +2351,11 @@ static int __init init (void) > retval = platform_device_add(the_hcd_pdev); > if (retval < 0) > goto err_add_hcd; > + if (!the_controller) { > + printk(KERN_ERR "Probe of the dummy hcd failed. Aborting.\n"); > + retval = -EINVAL; > + goto err_add_udc; > + } I don't think the printk is needed. As you pointed out, there will already be a warning message in the kernel log. Maybe just put a comment, saying that even though the platform device was added, the dummy_hcd_probe() call failed. And it looks like a similar test is needed after the second platform_device_add() -- although I'm not sure what's the best thing to test there. Maybe device_is_registered(&the_controller->gadget.dev). 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