Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist

From: Heikki Krogerus
Date: Fri May 22 2015 - 06:52:37 EST


On Fri, May 22, 2015 at 01:16:38PM +0300, Heikki Krogerus wrote:
> > > >>diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
> > > >>index 0e6f968..0b0a5e7 100644
> > > >>--- a/drivers/usb/common/ulpi.c
> > > >>+++ b/drivers/usb/common/ulpi.c
> > > >>@@ -132,6 +132,10 @@ int ulpi_register_driver(struct ulpi_driver *drv)
> > > >> if (!drv->probe)
> > > >> return -EINVAL;
> > > >>+ /* Was the bus registered successfully? */
> > > >>+ if (!ulpi_bus.p)
> > > >>+ return -ENODEV;
> >
> > I think we need to warn in this case. How about:
> >
> > if (unlikely(WARN_ON(!ulpi_bus.p)))
> > return -ENODEV;
>
> I think we should also return -EAGAIN here.

The same check needs to be added to ulpi_register_interface() as well.


Cheers,

--
heikki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/