| 1 | From 86e4cb35f2260374df4139c2352afe7fe247cb60 Mon Sep 17 00:00:00 2001 |
| 2 | From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 3 | Date: Mon, 6 Aug 2012 18:06:53 -0700 |
| 4 | Subject: [PATCH] usb: host: ehci-platform: BUG_ON() to WARN_ON() on probe |
| 5 | |
| 6 | Commit 86e4cb35f2260374df4139c2352afe7fe247cb60 upstream. |
| 7 | |
| 8 | usb_ehci_pdata is certainly required in ehci-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/ehci-platform.c | 6 +++++- |
| 17 | 1 file changed, 5 insertions(+), 1 deletion(-) |
| 18 | |
| 19 | --- a/drivers/usb/host/ehci-platform.c |
| 20 | +++ b/drivers/usb/host/ehci-platform.c |
| 21 | @@ -82,10 +82,14 @@ static int __devinit ehci_platform_probe |
| 22 | { |
| 23 | struct usb_hcd *hcd; |
| 24 | struct resource *res_mem; |
| 25 | + struct usb_ehci_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 | |