Commit df17aa9f authored by Li Jun's avatar Li Jun Committed by Peter Chen

usb: chipidea: imx: check data->usbmisc_data against NULL before access

As usbmisc_data is optional, so add the check before access its member,
this fix below static checker warning:
drivers/usb/chipidea/ci_hdrc_imx.c:438 ci_hdrc_imx_probe()
warn: 'data->usbmisc_data' can also be NULL
which is introduced by Patch 15b80f7c3a7f:
"usb: chipidea: imx: enable vbus and id wakeup only for OTG events"
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
parent 782c1c49
......@@ -433,6 +433,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
goto err_clk;
}
if (data->usbmisc_data) {
if (!IS_ERR(pdata.id_extcon.edev) ||
of_property_read_bool(np, "usb-role-switch"))
data->usbmisc_data->ext_id = 1;
......@@ -440,6 +441,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
if (!IS_ERR(pdata.vbus_extcon.edev) ||
of_property_read_bool(np, "usb-role-switch"))
data->usbmisc_data->ext_vbus = 1;
}
ret = imx_usbmisc_init_post(data->usbmisc_data);
if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment