| 1 | From b6dd245c4594482d46507a0bfd100439be367952 Mon Sep 17 00:00:00 2001 |
| 2 | From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 3 | Date: Mon, 6 Aug 2012 18:07:30 -0700 |
| 4 | Subject: [PATCH] usb: host: ohci-platform: BUG_ON() to WARN_ON() on probe |
| 5 | |
| 6 | Commit b6dd245c4594482d46507a0bfd100439be367952 upstream. |
| 7 | |
| 8 | usb_ohci_pdata is certainly required in ohci-platform driver. |
| 9 | This patch avoids using BUG_ON() from driver, |
| 10 | and return from probe with WARN_ON() if pdata was NULL. |
| 11 | |
| 12 | Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 13 | Acked-by: Alan Stern <stern@rowland.harvard.edu> |
| 14 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| 15 | --- |
| 16 | drivers/usb/host/ohci-platform.c | 6 +++++- |
| 17 | 1 file changed, 5 insertions(+), 1 deletion(-) |
| 18 | |
| 19 | --- a/drivers/usb/host/ohci-platform.c |
| 20 | +++ b/drivers/usb/host/ohci-platform.c |
| 21 | @@ -83,10 +83,14 @@ static int __devinit ohci_platform_probe |
| 22 | { |
| 23 | struct usb_hcd *hcd; |
| 24 | struct resource *res_mem; |
| 25 | + struct usb_ohci_pdata *pdata = dev->dev.platform_data; |
| 26 | int irq; |
| 27 | int err = -ENOMEM; |
| 28 | |
| 29 | - BUG_ON(!dev->dev.platform_data); |
| 30 | + if (!pdata) { |
| 31 | + WARN_ON(1); |
| 32 | + return -ENODEV; |
| 33 | + } |
| 34 | |
| 35 | if (usb_disabled()) |
| 36 | return -ENODEV; |
| 37 | |