usb: gadget: fsl: Fix registering from chipidea driver
The fsl gadget driver wants to configure the portsc register with information from platform_data. When registered from the chipidea driver there is no platform_data. Fix the resulting crash by not derefencing platform_data when NULL. In this case the PORTSC register is not touched, it will have been configured by the chipidea driver in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
acb28bb881
commit
c6edbecd68
|
@ -625,10 +625,13 @@ static int dr_controller_setup(struct fsl_udc *udc)
|
|||
case FSL_USB2_PHY_SERIAL:
|
||||
portctrl |= PORTSCX_PTS_FSLS;
|
||||
break;
|
||||
case FSL_USB2_PHY_NONE:
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
writel(portctrl, &dr_regs->portsc1);
|
||||
if (udc->phy_mode != FSL_USB2_PHY_NONE)
|
||||
writel(portctrl, &dr_regs->portsc1);
|
||||
|
||||
/* Stop and reset the usb controller */
|
||||
tmp = readl(&dr_regs->usbcmd);
|
||||
|
@ -2077,7 +2080,10 @@ static int struct_udc_setup(struct fsl_udc *udc,
|
|||
struct fsl_usb2_platform_data *pdata = dev->platform_data;
|
||||
size_t size;
|
||||
|
||||
udc->phy_mode = pdata->phy_mode;
|
||||
if (pdata)
|
||||
udc->phy_mode = pdata->phy_mode;
|
||||
else
|
||||
udc->phy_mode = FSL_USB2_PHY_NONE;
|
||||
|
||||
udc->eps = kzalloc(sizeof(struct fsl_ep) * udc->max_ep, GFP_KERNEL);
|
||||
if (!udc->eps) {
|
||||
|
|
Loading…
Reference in New Issue