mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] USB: Check init/post_init errors
Date: Tue, 22 Oct 2013 08:53:35 +0200	[thread overview]
Message-ID: <20131022065335.GI30088@pengutronix.de> (raw)
In-Reply-To: <1382343862-18098-1-git-send-email-shc_work@mail.ru>

On Mon, Oct 21, 2013 at 12:24:22PM +0400, Alexander Shiyan wrote:
> Host with inoperable ULPI able to bring the system into an
> infinite loop. The patch adds error checking during initialization
> to avoid this.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied, thanks

Sascha

> ---
>  drivers/usb/host/ehci-hcd.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index cb6a592..2da3edd 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -748,6 +748,7 @@ static int ehci_init(struct usb_host *host)
>  	struct ehci_priv *ehci = to_ehci(host);
>  	uint32_t reg;
>  	uint32_t cmd;
> +	int ret = 0;
>  
>  	ehci_halt(ehci);
>  
> @@ -755,8 +756,11 @@ static int ehci_init(struct usb_host *host)
>  	if (ehci_reset(ehci) != 0)
>  		return -1;
>  
> -	if (ehci->init)
> -		ehci->init(ehci->drvdata);
> +	if (ehci->init) {
> +		ret = ehci->init(ehci->drvdata);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	ehci->qh_list->qh_link = cpu_to_hc32((uint32_t)ehci->qh_list | QH_LINK_TYPE_QH);
>  	ehci->qh_list->qh_endpt1 = cpu_to_hc32((1 << 15) | (USB_SPEED_HIGH << 12));
> @@ -799,9 +803,9 @@ static int ehci_init(struct usb_host *host)
>  	ehci->rootdev = 0;
>  
>  	if (ehci->post_init)
> -		ehci->post_init(ehci->drvdata);
> +		ret = ehci->post_init(ehci->drvdata);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-10-22  6:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21  8:24 Alexander Shiyan
2013-10-22  6:53 ` Sascha Hauer [this message]

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=20131022065335.GI30088@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=shc_work@mail.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox