Skip to content

Commit

Permalink
usb: dwc3: core: cope with NULL pdata
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Aug 14, 2013
1 parent e57e780 commit bb67490
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,17 @@ static int dwc3_probe(struct platform_device *pdev)

dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
dwc->dr_mode = of_usb_get_dr_mode(node);
} else {
} else if (pdata) {
dwc->maximum_speed = pdata->maximum_speed;

dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);

dwc->needs_fifo_resize = pdata->tx_fifo_resize;
dwc->dr_mode = pdata->dr_mode;
} else {
dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
}

/* default to superspeed if no maximum_speed passed */
Expand Down

0 comments on commit bb67490

Please sign in to comment.