lkml.org 
[lkml]   [2015]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] staging: emxx_udc: emxx_udc: Removed variables that is never used
From
On Thu, Jan 29, 2015 at 3:52 PM, Rickard Strandqvist
<rickard_strandqvist@spectrumdigital.se> wrote:
> The last one was more interesting, se below.
> But I can not really see how any error should be handled here?
> Proposal to change to:
>
> if (kstrtol(tempbuf, 16, &num) == 0 && num == 0)

That whole chunk of code looks odd. Why the base 16 conversion when
we already know it's a decimal digit? Seems like this would work
without the hassle of the string conversion:

-- >8 --

--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -3262,16 +3262,7 @@ static void __init nbu2ss_drv_set_ep_info(
ep->ep.ops = &nbu2ss_ep_ops;

if (isdigit(name[2])) {
-
- long num;
- int res;
- char tempbuf[2];
-
- tempbuf[0] = name[2];
- tempbuf[1] = '\0';
- res = kstrtol(tempbuf, 16, &num);
-
- if (num == 0)
+ if (name[2] == '0')
ep->ep.maxpacket = EP0_PACKETSIZE;
else
ep->ep.maxpacket = EP_PACKETSIZE;

\
 
 \ /
  Last update: 2015-01-30 01:01    [W:0.048 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site