From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Date: Wed, 22 May 2013 19:50:21 +0000 Subject: Re: [PATCH] ARM: shmobile: marzen: Use error values in usb_power_* Message-Id: <519D217D.2060405@cogentembedded.com> List-Id: References: <1369205290-6272-1-git-send-email-horms+renesas@verge.net.au> <1369205290-6272-2-git-send-email-horms+renesas@verge.net.au> In-Reply-To: <1369205290-6272-2-git-send-email-horms+renesas@verge.net.au> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@lists.infradead.org Hello. On 05/22/2013 10:48 AM, Simon Horman wrote: > This patch updates the marzen board code as if USB PHY isn't enabled > they phy will have a value set by ERR_PTR() rather than be NULL. > > Without this patch a NULL pointer dereference and kernel panic > occurs on initialisation of USB on marzen. > > This resolves a regression introduced in 3.10-rc1 by > b7fa5c2aec5be083eb2719b405089703608e9bc6 > ("usb: phy: return -ENXIO when PHY layer isn't enabled"). > > Tested-by: Nguyen Hong Ky > Signed-off-by: Simon Horman > --- > arch/arm/mach-shmobile/board-marzen.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c > index 9105285..b9594e9 100644 > --- a/arch/arm/mach-shmobile/board-marzen.c > +++ b/arch/arm/mach-shmobile/board-marzen.c > @@ -212,8 +212,8 @@ static struct platform_device *marzen_devices[] __initdata = { > static struct usb_phy *phy; > static int usb_power_on(struct platform_device *pdev) > { > - if (!phy) > - return -EIO; > + if (IS_ERR(phy)) And even before the mentioned commit the right check should have been IS_ERR_OR_NULL(). Thanks for finding/fixing this. Too bad I'll have to respin my USB patches now... :-) WBR, Sergei From mboxrd@z Thu Jan 1 00:00:00 1970 From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov) Date: Wed, 22 May 2013 23:50:21 +0400 Subject: [PATCH] ARM: shmobile: marzen: Use error values in usb_power_* In-Reply-To: <1369205290-6272-2-git-send-email-horms+renesas@verge.net.au> References: <1369205290-6272-1-git-send-email-horms+renesas@verge.net.au> <1369205290-6272-2-git-send-email-horms+renesas@verge.net.au> Message-ID: <519D217D.2060405@cogentembedded.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hello. On 05/22/2013 10:48 AM, Simon Horman wrote: > This patch updates the marzen board code as if USB PHY isn't enabled > they phy will have a value set by ERR_PTR() rather than be NULL. > > Without this patch a NULL pointer dereference and kernel panic > occurs on initialisation of USB on marzen. > > This resolves a regression introduced in 3.10-rc1 by > b7fa5c2aec5be083eb2719b405089703608e9bc6 > ("usb: phy: return -ENXIO when PHY layer isn't enabled"). > > Tested-by: Nguyen Hong Ky > Signed-off-by: Simon Horman > --- > arch/arm/mach-shmobile/board-marzen.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c > index 9105285..b9594e9 100644 > --- a/arch/arm/mach-shmobile/board-marzen.c > +++ b/arch/arm/mach-shmobile/board-marzen.c > @@ -212,8 +212,8 @@ static struct platform_device *marzen_devices[] __initdata = { > static struct usb_phy *phy; > static int usb_power_on(struct platform_device *pdev) > { > - if (!phy) > - return -EIO; > + if (IS_ERR(phy)) And even before the mentioned commit the right check should have been IS_ERR_OR_NULL(). Thanks for finding/fixing this. Too bad I'll have to respin my USB patches now... :-) WBR, Sergei