usb: fix possible null pointer dereference.

PD#167891: usb: fix possible null pointer dereference.

Change-Id: I683422ad8c6ff386eec3d0c7ace9310dca1c1fe6
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
This commit is contained in:
Yue Wang
2018-06-06 17:05:31 +08:00
committed by Yixun Lan
parent 549632f69e
commit fe20edf1d3
2 changed files with 11 additions and 6 deletions

View File

@@ -108,8 +108,12 @@ static void amlogic_new_usb3phy_shutdown(struct usb_phy *x)
void aml_new_usb_v2_init(void)
{
union usb_r5_v2 r5 = {.d32 = 0};
unsigned long reg_addr = (unsigned long)
g_phy_v2->usb2_phy_cfg;
unsigned long reg_addr;
if (!g_phy_v2)
return;
reg_addr = (unsigned long)g_phy_v2->usb2_phy_cfg;
r5.d32 = readl(usb_new_aml_regs_v2.usb_r_v2[5]);
if (r5.b.iddig_curr == 0) {

View File

@@ -938,10 +938,11 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
}
#ifdef CONFIG_AMLOGIC_USB
if (dwc->usb3_phy->flags == AML_USB3_PHY_ENABLE)
dwc->super_speed_support = 1;
else
dwc->super_speed_support = 0;
dwc->super_speed_support = 0;
if (dwc->usb3_phy)
if (dwc->usb3_phy->flags == AML_USB3_PHY_ENABLE)
dwc->super_speed_support = 1;
#endif
dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy");