diff mbox series

[RESEND] usb: dwc3: fix NULL pointer issue

Message ID 1589435712-8795-1-git-send-email-chunfeng.yun@mediatek.com
State Accepted
Commit 58221d7e876c2f75ae7696aad853d81ccd76fb7a
Headers show
Series [RESEND] usb: dwc3: fix NULL pointer issue | expand

Commit Message

Chunfeng Yun (云春峰) May 14, 2020, 5:55 a.m. UTC
The phy_bulk pointer *usb_phys is used before allocated,
fix it by using a phy_bulk variable instead in
xhci_dwc3_platdata struct

Signed-off-by: Chunfeng Yun <chunfeng.yun at mediatek.com>
---
 drivers/usb/host/xhci-dwc3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Chunfeng Yun (云春峰) May 20, 2020, 7:53 a.m. UTC | #1
Hi Marek,

On Thu, 2020-05-14 at 13:55 +0800, Chunfeng Yun wrote:
> The phy_bulk pointer *usb_phys is used before allocated,
> fix it by using a phy_bulk variable instead in
> xhci_dwc3_platdata struct
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun at mediatek.com>
> ---
>  drivers/usb/host/xhci-dwc3.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
> index 563db1a426..51c04a9de2 100644
> --- a/drivers/usb/host/xhci-dwc3.c
> +++ b/drivers/usb/host/xhci-dwc3.c
> @@ -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);
>  }

Would you please help to pick up this patch?  This bug is introduced
when I support MTK xHCI driver. Thanks
Marek Vasut May 20, 2020, 11:44 a.m. UTC | #2
On 5/20/20 9:53 AM, Chunfeng Yun wrote:
> Hi Marek,
> 
> On Thu, 2020-05-14 at 13:55 +0800, Chunfeng Yun wrote:
>> 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.
Chunfeng Yun (云春峰) May 21, 2020, 1:42 a.m. UTC | #3
Hi Marek,
On Wed, 2020-05-20 at 13:44 +0200, Marek Vasut wrote:
> On 5/20/20 9:53 AM, Chunfeng Yun wrote:
> > Hi Marek,
> > 
> > On Thu, 2020-05-14 at 13:55 +0800, Chunfeng Yun wrote:
> >> 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 <chunfeng.yun at mediatek.com>)
	(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 at mhfsdcap03>
Subject: Re: [RESEND PATCH] usb: dwc3: fix NULL pointer issue
From: Chunfeng Yun <chunfeng.yun at mediatek.com>
To: Marek Vasut <marex at denx.de>
CC: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream at mediatek.com>, Ryder
Lee
	<ryder.lee at mediatek.com>, Weijie Gao <weijie.gao at mediatek.com>,
	<u-boot at lists.denx.de>
Date: Wed, 20 May 2020 15:53:58 +0800
In-Reply-To:
<1589435712-8795-1-git-send-email-chunfeng.yun at mediatek.com>
References: <1589435712-8795-1-git-send-email-chunfeng.yun at mediatek.com>
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


> 
> Anyway, I'll pick this one, thanks.
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index 563db1a426..51c04a9de2 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -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);
 }