All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: balbi@kernel.org, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 5/6] usb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns error
Date: Tue, 15 May 2018 09:31:03 +0200	[thread overview]
Message-ID: <20180515073103.urmp3mbvzhxjdjyi@verge.net.au> (raw)
In-Reply-To: <1523338734-20474-6-git-send-email-yoshihiro.shimoda.uh@renesas.com>

On Tue, Apr 10, 2018 at 02:38:53PM +0900, Yoshihiro Shimoda wrote:
> This patch fixes an issue that this driver ignores errors other than
> the non-existence of the device, f.e. a memory allocation failure
> in devm_phy_get(). So, this patch replaces devm_phy_get() with
> devm_phy_optional_get().
> 
> Reported-by: Simon Horman <horms+renesas@verge.net.au>
> Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy")
> Cc: <stable@vger.kernel.org> # v4.15+
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

> ---
> Remarks:
>  - A new file in v2
> 
>  drivers/usb/gadget/udc/renesas_usb3.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
> index 233bc04..0e70163 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -2636,9 +2636,11 @@ static int renesas_usb3_probe(struct platform_device *pdev)
>  	 * This is optional. So, if this driver cannot get a phy,
>  	 * this driver will not handle a phy anymore.
>  	 */
> -	usb3->phy = devm_phy_get(&pdev->dev, "usb");
> -	if (IS_ERR(usb3->phy))
> -		usb3->phy = NULL;
> +	usb3->phy = devm_phy_optional_get(&pdev->dev, "usb");
> +	if (IS_ERR(usb3->phy)) {
> +		ret = PTR_ERR(usb3->phy);
> +		goto err_add_udc;
> +	}
>  
>  	pm_runtime_enable(&pdev->dev);
>  	ret = usb_add_gadget_udc(&pdev->dev, &usb3->gadget);
> -- 
> 1.9.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@verge.net.au>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: balbi@kernel.org, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	stable@vger.kernel.org
Subject: [v2,5/6] usb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns error
Date: Tue, 15 May 2018 09:31:03 +0200	[thread overview]
Message-ID: <20180515073103.urmp3mbvzhxjdjyi@verge.net.au> (raw)

On Tue, Apr 10, 2018 at 02:38:53PM +0900, Yoshihiro Shimoda wrote:
> This patch fixes an issue that this driver ignores errors other than
> the non-existence of the device, f.e. a memory allocation failure
> in devm_phy_get(). So, this patch replaces devm_phy_get() with
> devm_phy_optional_get().
> 
> Reported-by: Simon Horman <horms+renesas@verge.net.au>
> Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy")
> Cc: <stable@vger.kernel.org> # v4.15+
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

> ---
> Remarks:
>  - A new file in v2
> 
>  drivers/usb/gadget/udc/renesas_usb3.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
> index 233bc04..0e70163 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -2636,9 +2636,11 @@ static int renesas_usb3_probe(struct platform_device *pdev)
>  	 * This is optional. So, if this driver cannot get a phy,
>  	 * this driver will not handle a phy anymore.
>  	 */
> -	usb3->phy = devm_phy_get(&pdev->dev, "usb");
> -	if (IS_ERR(usb3->phy))
> -		usb3->phy = NULL;
> +	usb3->phy = devm_phy_optional_get(&pdev->dev, "usb");
> +	if (IS_ERR(usb3->phy)) {
> +		ret = PTR_ERR(usb3->phy);
> +		goto err_add_udc;
> +	}
>  
>  	pm_runtime_enable(&pdev->dev);
>  	ret = usb_add_gadget_udc(&pdev->dev, &usb3->gadget);
> -- 
> 1.9.1
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-05-15  7:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  5:38 [PATCH v2 0/6] usb: gadget: udc: renesas_usb3: fix some major issues Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 1/6] usb: gadget: udc: renesas_usb3: fix double phy_put() Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,1/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 2/6] usb: gadget: udc: renesas_usb3: should remove debugfs Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,2/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 3/6] usb: gadget: udc: renesas_usb3: should call pm_runtime_enable() before add udc Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,3/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 4/6] usb: gadget: udc: renesas_usb3: should call devm_phy_get() " Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,4/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 5/6] usb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns error Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,5/6] " Yoshihiro Shimoda
2018-04-10  9:35   ` [PATCH v2 5/6] " Simon Horman
2018-04-10  9:35     ` [v2,5/6] " Simon Horman
2018-05-15  7:31   ` Simon Horman [this message]
2018-05-15  7:31     ` Simon Horman
2018-04-10  5:38 ` [PATCH v2 6/6] usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,6/6] " Yoshihiro Shimoda
2018-04-10  9:34   ` [PATCH v2 6/6] " Simon Horman
2018-04-10  9:34     ` [v2,6/6] " Simon Horman
2018-05-15  7:35   ` [PATCH v2 6/6] " Simon Horman
2018-05-15  7:35     ` [v2,6/6] " Simon Horman
2018-05-15  7:49     ` [PATCH v2 6/6] " Yoshihiro Shimoda
2018-05-15  7:49       ` [v2,6/6] " Yoshihiro Shimoda
2018-05-15  7:55       ` [PATCH v2 6/6] " Simon Horman
2018-05-15  7:55         ` [v2,6/6] " Simon Horman
2018-05-10  7:25 ` [PATCH v2 0/6] usb: gadget: udc: renesas_usb3: fix some major issues Yoshihiro Shimoda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180515073103.urmp3mbvzhxjdjyi@verge.net.au \
    --to=horms@verge.net.au \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.