usb: host: ohci-platform: BUG_ON() to WARN_ON() on probe
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 7 Aug 2012 01:07:30 +0000 (18:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Aug 2012 19:05:32 +0000 (12:05 -0700)
usb_ohci_pdata is certainly required in ohci-platform driver.
This patch avoids using BUG_ON() from driver,
and return from probe with WARN_ON() if pdata was NULL.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ohci-platform.c

index 670c705..4c886f9 100644 (file)
@@ -83,10 +83,14 @@ static int __devinit ohci_platform_probe(struct platform_device *dev)
 {
        struct usb_hcd *hcd;
        struct resource *res_mem;
+       struct usb_ohci_pdata *pdata = dev->dev.platform_data;
        int irq;
        int err = -ENOMEM;
 
-       BUG_ON(!dev->dev.platform_data);
+       if (!pdata) {
+               WARN_ON(1);
+               return -ENODEV;
+       }
 
        if (usb_disabled())
                return -ENODEV;