lkml.org 
[lkml]   [2009]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/7] usb: trivial cleanups
Date
It seems 'min_t' was used before, and looks cleaner, plus white-space
stuff.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
drivers/usb/core/hcd.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 34de475..e6d754e 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -396,8 +396,7 @@ rh_string(int id, struct usb_hcd const *hcd, u8 *data, unsigned len)
case 0:
/* Array of LANGID codes (0x0409 is MSFT-speak for "en-us") */
/* See http://www.usb.org/developers/docs/USB_LANGIDs.pdf */
- if (len > 4)
- len = 4;
+ len = min_t(unsigned, len, sizeof(langids));
memcpy(data, langids, len);
return len;
case 1:
@@ -410,8 +409,8 @@ rh_string(int id, struct usb_hcd const *hcd, u8 *data, unsigned len)
break;
case 3:
/* Manufacturer */
- snprintf (buf, sizeof buf, "%s %s %s", init_utsname()->sysname,
- init_utsname()->release, hcd->driver->description);
+ snprintf(buf, sizeof buf, "%s %s %s", init_utsname()->sysname,
+ init_utsname()->release, hcd->driver->description);
s = buf;
break;
default:
--
1.6.5.1


\
 
 \ /
  Last update: 2009-10-19 00:57    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site