diff options
author | Felipe Balbi <balbi@ti.com> | 2013-08-14 14:21:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-14 15:23:09 -0400 |
commit | bb674907111272ca40926ca3d3bad4046fffed52 (patch) | |
tree | 54717e6e7813ce21692c4133d61dbe1b59a04c2c /drivers/usb/dwc3/core.c | |
parent | e57e780b346a7277fdd3bde765d9d8728b99bfa1 (diff) |
usb: dwc3: core: cope with NULL pdata
if pdata is a NULL pointer we could cause a
kernel oops when probing the driver. Make sure
to cope with systems which won't pass pdata
to the driver.
Tested-by: Paul Zimmerman <paulz@synopsys.com>
Reported-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r-- | drivers/usb/dwc3/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3ff6f0ad01df..577af1b237f2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -393,7 +393,7 @@ static int dwc3_probe(struct platform_device *pdev) | |||
393 | 393 | ||
394 | dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); | 394 | dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize"); |
395 | dwc->dr_mode = of_usb_get_dr_mode(node); | 395 | dwc->dr_mode = of_usb_get_dr_mode(node); |
396 | } else { | 396 | } else if (pdata) { |
397 | dwc->maximum_speed = pdata->maximum_speed; | 397 | dwc->maximum_speed = pdata->maximum_speed; |
398 | 398 | ||
399 | dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | 399 | dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); |
@@ -401,6 +401,9 @@ static int dwc3_probe(struct platform_device *pdev) | |||
401 | 401 | ||
402 | dwc->needs_fifo_resize = pdata->tx_fifo_resize; | 402 | dwc->needs_fifo_resize = pdata->tx_fifo_resize; |
403 | dwc->dr_mode = pdata->dr_mode; | 403 | dwc->dr_mode = pdata->dr_mode; |
404 | } else { | ||
405 | dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | ||
406 | dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3); | ||
404 | } | 407 | } |
405 | 408 | ||
406 | /* default to superspeed if no maximum_speed passed */ | 409 | /* default to superspeed if no maximum_speed passed */ |