[PATCH] usb: dwc2: bail out early when booting with "nousb"

2014-02-04 Thread Andre Heider
Add usb_disabled() check to prevent kernel oops when booting with "nousb"
in the cmdline:

Unable to handle kernel NULL pointer dereference at virtual address 0030
...
PC is at bus_add_device+0xe0/0x18c
LR is at device_add_groups+0x1c/0x20
...
[] (bus_add_device) from [] (device_add+0x41c/0x538)
[] (device_add) from [] (usb_new_device+0x270/0x35c)
[] (usb_new_device) from [] (usb_add_hcd+0x4fc/0x760)
[] (usb_add_hcd) from [] (dwc2_hcd_init+0x434/0x510)
[] (dwc2_hcd_init) from [] (dwc2_driver_probe+0x130/0x170)
[] (dwc2_driver_probe) from [] 
(platform_drv_probe+0x28/0x58)

Signed-off-by: Andre Heider 
Acked-by: Paul Zimmerman 
---
 drivers/usb/dwc2/platform.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index d01d0d3..eaba547 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -124,6 +124,9 @@ static int dwc2_driver_probe(struct platform_device *dev)
int retval;
int irq;
 
+   if (usb_disabled())
+   return -ENODEV;
+
match = of_match_device(dwc2_of_match_table, &dev->dev);
if (match && match->data) {
params = match->data;
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: dwc2: bail out early when booting with "nousb"

2014-02-04 Thread Andre Heider
On Tue, Feb 04, 2014 at 08:10:19PM +, Paul Zimmerman wrote:
> > From: Andre Heider [mailto:a.hei...@gmail.com]
> > Sent: Tuesday, February 04, 2014 10:44 AM
> > 
> > Add usb_disabled() check to prevent kernel oops when booting with "nousb"
> > in the cmdline:
> 
> Hi Andre,
> 
> Please resend this with GregKH on Cc, since he is the maintainer of the
> USB tree and is the one who will apply the patch. You can add my:
> 
> Acked-by: Paul Zimmerman 

Okay, thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: dwc2: bail out early when booting with "nousb"

2014-02-04 Thread Paul Zimmerman
> From: Andre Heider [mailto:a.hei...@gmail.com]
> Sent: Tuesday, February 04, 2014 10:44 AM
> 
> Add usb_disabled() check to prevent kernel oops when booting with "nousb"
> in the cmdline:

Hi Andre,

Please resend this with GregKH on Cc, since he is the maintainer of the
USB tree and is the one who will apply the patch. You can add my:

Acked-by: Paul Zimmerman 

-- 
Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: dwc2: bail out early when booting with "nousb"

2014-02-04 Thread Andre Heider
Add usb_disabled() check to prevent kernel oops when booting with "nousb"
in the cmdline:

Unable to handle kernel NULL pointer dereference at virtual address 0030
...
PC is at bus_add_device+0xe0/0x18c
LR is at device_add_groups+0x1c/0x20
...
[] (bus_add_device) from [] (device_add+0x41c/0x538)
[] (device_add) from [] (usb_new_device+0x270/0x35c)
[] (usb_new_device) from [] (usb_add_hcd+0x4fc/0x760)
[] (usb_add_hcd) from [] (dwc2_hcd_init+0x434/0x510)
[] (dwc2_hcd_init) from [] (dwc2_driver_probe+0x130/0x170)
[] (dwc2_driver_probe) from [] 
(platform_drv_probe+0x28/0x58)

Signed-off-by: Andre Heider 
---
 drivers/usb/dwc2/platform.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index d01d0d3..eaba547 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -124,6 +124,9 @@ static int dwc2_driver_probe(struct platform_device *dev)
int retval;
int irq;
 
+   if (usb_disabled())
+   return -ENODEV;
+
match = of_match_device(dwc2_of_match_table, &dev->dev);
if (match && match->data) {
params = match->data;
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html