Skip to contentSkip to conversation

usb: dwc3: fix NULL pointer issue

PATCH RESEND Superseded Chunfeng Yun 2 participants 4 messages May 14, 2020 – May 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 usb: dwc3: fix NULL pointer issue

The phy_bulk pointer *usb_phys is used before allocated, fix it by using a phy_bulk variable instead in xhci_dwc3_platdata struct

---
 drivers/usb/host/xhci-dwc3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-dwc3.c +3 -3
index 563db1a426..51c04a9de2 100644
@@ -19,7 +19,7 @@
 #include <linux/usb/otg.h>
 
 struct xhci_dwc3_platdata {
-	struct phy_bulk *usb_phys;
+	struct phy_bulk phys;
 };
 
 void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
@@ -124,7 +124,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
 	hcor = (struct xhci_hcor *)((uintptr_t)hccr +
 			HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
 
-	ret = dwc3_setup_phy(dev, plat->usb_phys);
+	ret = dwc3_setup_phy(dev, &plat->phys);
 	if (ret && (ret != -ENOTSUPP))
 		return ret;
 
@@ -167,7 +167,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
 {
 	struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
 
-	dwc3_shutdown_phy(dev, plat->usb_phys);
+	dwc3_shutdown_phy(dev, &plat->phys);
 
 	return xhci_deregister(dev);
 }
Signature · 1 line
2.25.1
#1 lore raw

PATCH RESEND 1/1 usb: dwc3: fix NULL pointer issue

Hi Marek,

Quoted 32 lines · Chunfeng Yun

The phy_bulk pointer *usb_phys is used before allocated, fix it by using a phy_bulk variable instead in xhci_dwc3_platdata struct

---
 drivers/usb/host/xhci-dwc3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-dwc3.c +2 -2
index 563db1a426..51c04a9de2 100644
@@ -19,7 +19,7 @@
 #include <linux/usb/otg.h>
 
 struct xhci_dwc3_platdata {
-	struct phy_bulk *usb_phys;
+	struct phy_bulk phys;
 };
 
 void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
@@ -124,7 +124,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
 	hcor = (struct xhci_hcor *)((uintptr_t)hccr +
 			HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
 
-	ret = dwc3_setup_phy(dev, plat->usb_phys);
+	ret = dwc3_setup_phy(dev, &plat->phys);
 	if (ret && (ret != -ENOTSUPP))
 		return ret;
 

drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_remove(struct udevice *dev) · line 173

Quoted 8 lines
drivers/usb/host/xhci-dwc3.c +1 -1
@@ -167,7 +167,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
 {
 	struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
 
-	dwc3_shutdown_phy(dev, plat->usb_phys);
+	dwc3_shutdown_phy(dev, &plat->phys);
 
 	return xhci_deregister(dev);
 }

Would you please help to pick up this patch? This bug is introduced when I support MTK xHCI driver. Thanks

#2 lore raw

PATCH RESEND 1/1 usb: dwc3: fix NULL pointer issue

Quoted 7 lines · Chunfeng Yun

Hi Marek,

Quoted 4 lines · Chunfeng Yun

The phy_bulk pointer *usb_phys is used before allocated, fix it by using a phy_bulk variable instead in xhci_dwc3_platdata struct

I'm never receiving the emails to the denx address listed in the MAINTAINERS, any ideas why ?

Anyway, I'll pick this one, thanks.

#3 lore raw

PATCH RESEND 1/1 usb: dwc3: fix NULL pointer issue

Hi Marek,

Quoted 11 lines · Marek Vasut
Quoted 7 lines · Chunfeng Yun

Hi Marek,

Quoted 4 lines · Chunfeng Yun

The phy_bulk pointer *usb_phys is used before allocated, fix it by using a phy_bulk variable instead in xhci_dwc3_platdata struct

I'm never receiving the emails to the denx address listed in the MAINTAINERS, any ideas why ?

I received the following email when I sent out this patch. It seems the email is sent out, but rejected by server of denx

------------------------

Delivery has failed to these recipients or groups:

marex at denx.de
A problem occurred while delivering this message to this email address. Try sending this message again. If the problem continues, please contact your helpdesk.

The following organization rejected your message: mail-in.m-online.net [212.114.242.10].

Diagnostic information for administrators:

Generating server: mailgw01.mediatek.com
marex at denx.de
mail-in.m-online.net [212.114.242.10]
Remote Server returned '<mail-in.m-online.net [212.114.242.10] #5.0.0 SMTP; mail-in.m-online.net {mxin-2.m-online.net} ESMTP>' Original message headers:

X-UUID: 6e032eea3af94db48b3664ec8823e2a7-20200520
Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com

	(envelope-from <[email protected]>)
	(mailgw01.mediatek.com ESMTP with TLS)
	with ESMTP id 2105128150; Wed, 20 May 2020 15:55:38 +0800

Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31DR.mediatek.inc
(172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 20
May
2020 15:55:29 +0800
Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc
(172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 20 May 2020 15:55:29 +0800
Message-ID: <1589961238.5899.11.camel@mhfsdcap03>
Subject: Re: [RESEND PATCH] usb: dwc3: fix NULL pointer issue
From: Chunfeng Yun <[email protected]>
To: Marek Vasut <[email protected]>
CC: GSS_MTK_Uboot_upstream <[email protected]>, Ryder Lee

	<[email protected]>, Weijie Gao <[email protected]>,
	<[email protected]>

Date: Wed, 20 May 2020 15:53:58 +0800
In-Reply-To:
<[email protected]>
References: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.10.4-0ubuntu2
MIME-Version: 1.0
Return-Path: chunfeng.yun at mediatek.com
X-TM-SNTS-SMTP:
E0F7570E13FD8D3A61E4045528ADEB2EACBDAE6D62C5746A8BE200F57E6BB7C92000:8
X-MTK: N
Content-Transfer-Encoding: base64

Quoted 2 lines

Anyway, I'll pick this one, thanks.