public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Paul Kocialkowski <contact@paulk.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/3] usb: usb_new_device return codes consistency
Date: Mon, 30 Mar 2015 15:36:29 +0200	[thread overview]
Message-ID: <1427722589.2521.10.camel@collins> (raw)
In-Reply-To: <20150330100607.52fd98c8@amdc2363>

Le lundi 30 mars 2015 ? 10:06 +0200, Lukasz Majewski a ?crit :
> Hi Paul,
> 
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >  common/usb.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/common/usb.c b/common/usb.c
> > index 32e15cd..ea5b406 100644
> > --- a/common/usb.c
> > +++ b/common/usb.c
> > @@ -915,7 +915,7 @@ int usb_new_device(struct usb_device *dev)
> >  	if (err < 8) {
> >  		printf("\n      USB device not responding, " \
> >  		       "giving up (status=%lX)\n", dev->status);
> > -		return 1;
> > +		return -1;
> 
> If you are going to provide consistency with error codes, then I think
> that it would be beneficial to return -Exxx codes (like -EINVAL, etc).

That makes sense, I'll give it a try soon (I'm not sure I'll get all the
appropriate error codes right at first try though).

> >  	}
> >  	memcpy(&dev->descriptor, tmpbuf, 8);
> >  #else
> > @@ -952,7 +952,7 @@ int usb_new_device(struct usb_device *dev)
> >  	err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64);
> >  	if (err < 0) {
> >  		debug("usb_new_device: usb_get_descriptor()
> > failed\n");
> > -		return 1;
> > +		return -1;
> >  	}
> >  
> >  	dev->descriptor.bMaxPacketSize0 = desc->bMaxPacketSize0;
> > @@ -968,7 +968,7 @@ int usb_new_device(struct usb_device *dev)
> >  		err = hub_port_reset(dev->parent, dev->portnr - 1,
> > &portstatus); if (err < 0) {
> >  			printf("\n     Couldn't reset port %i\n",
> > dev->portnr);
> > -			return 1;
> > +			return -1;
> >  		}
> >  	} else {
> >  		usb_reset_root_port();
> > @@ -1014,7 +1014,7 @@ int usb_new_device(struct usb_device *dev)
> >  		else
> >  			printf("USB device descriptor short read " \
> >  				"(expected %i, got %i)\n", tmp, err);
> > -		return 1;
> > +		return -1;
> >  	}
> >  	memcpy(&dev->descriptor, tmpbuf, sizeof(dev->descriptor));
> >  	/* correct le values */
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150330/c92ee3f7/attachment.sig>

  reply	other threads:[~2015-03-30 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-29 10:28 [U-Boot] [PATCH v2 1/3] usb: usb_new_device return codes consistency Paul Kocialkowski
2015-03-29 10:28 ` [U-Boot] [PATCH v2 2/3] usb: Check usb_new_device for failure Paul Kocialkowski
2015-04-03  2:03   ` Marek Vasut
2015-03-29 10:28 ` [U-Boot] [PATCH v2 3/3] usb: Early failure when the first descriptor read fails or is invalid Paul Kocialkowski
2015-04-03  2:03   ` Marek Vasut
2015-03-30  8:06 ` [U-Boot] [PATCH v2 1/3] usb: usb_new_device return codes consistency Lukasz Majewski
2015-03-30 13:36   ` Paul Kocialkowski [this message]
2015-04-02 17:12     ` Marek Vasut

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=1427722589.2521.10.camel@collins \
    --to=contact@paulk.fr \
    --cc=u-boot@lists.denx.de \
    /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