[U-Boot] [PATCH 8/8] USB: gadget: change simple_strtol to simple_strtoul

Vitaly Kuzmichev vkuzmichev at mvista.com
Thu Aug 12 14:44:46 CEST 2010


From: Julia Lawall <julia at diku.dk>

Since num is unsigned, it would seem better to use simple_strtoul that
simple_strtol.

A simplified version of the semantic patch that makes this change is as
follows: (http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r2@
long e;
position p;
@@

e = simple_strtol at p(...)

@@
position p != r2.p;
type T;
T e;
@@

e =
- simple_strtol at p
+ simple_strtoul
  (...)
// </smpl>

Signed-off-by: Julia Lawall <julia at diku.dk>
Acked-by: David Brownell <dbrownell at users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

(cherry picked from commit bb9496c6f7e853e5d4edd5397c9d45f1968d623c)

Signed-off-by: Vitaly Kuzmichev <vkuzmichev at mvista.com>
---
 drivers/usb/gadget/epautoconf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index c7fad39..e11cc20 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -156,7 +156,7 @@ ep_matches (
 
 	/* report address */
 	if (isdigit (ep->name [2])) {
-		u8	num = simple_strtol (&ep->name [2], NULL, 10);
+		u8	num = simple_strtoul (&ep->name [2], NULL, 10);
 		desc->bEndpointAddress |= num;
 #ifdef	MANY_ENDPOINTS
 	} else if (desc->bEndpointAddress & USB_DIR_IN) {
-- 
1.7.1.1



More information about the U-Boot mailing list