lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEUsAPbp1kfax3K9Jrf538c3i8micqJHcPnkrFP7G04VjxW5ew@mail.gmail.com>
Date:	Thu, 29 Jan 2015 19:58:52 -0600
From:	Chris Rorvick <chris@...vick.com>
To:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Vincenzo Scotti <vinc94@...il.com>,
	Roberta Dobrescu <roberta.dobrescu@...il.com>,
	Sachin Kamat <sachin.kamat@...sung.com>,
	Simon Horman <horms+renesas@...ge.net.au>,
	Ebru Akagunduz <ebru.akagunduz@...il.com>,
	Magnus Damm <damm+renesas@...nsource.se>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: emxx_udc: emxx_udc: Removed variables that is
 never used

On Thu, Jan 29, 2015 at 5:46 PM, Chris Rorvick <chris@...vick.com> wrote:
> 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:

Hmm, or probably even better to do this where the ep0 check is less contorted.

-- >8 --

diff --git a/drivers/staging/emxx_udc/emxx_udc.c
b/drivers/staging/emxx_udc/emxx_udc.c
index eb178fc..98a1ace 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -3261,25 +3261,6 @@ static void __init nbu2ss_drv_set_ep_info(
        ep->ep.name = name;
        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)
-                       ep->ep.maxpacket = EP0_PACKETSIZE;
-               else
-                       ep->ep.maxpacket = EP_PACKETSIZE;
-
-       } else {
-               ep->ep.maxpacket = EP_PACKETSIZE;
-       }
-
        list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
        INIT_LIST_HEAD(&ep->queue);
 }
@@ -3293,8 +3274,12 @@ static void __init nbu2ss_drv_ep_init(struct
nbu2ss_udc *udc)
        udc->gadget.ep0 = &udc->ep[0].ep;


-       for (i = 0; i < NUM_ENDPOINTS; i++)
-               nbu2ss_drv_set_ep_info(udc, &udc->ep[i], gp_ep_name[i]);
+       for (i = 0; i < NUM_ENDPOINTS; i++) {
+               struct nbu2ss_ep *ep = &udc->ep[i];
+
+               nbu2ss_drv_set_ep_info(udc, ep, gp_ep_name[i]);
+               ep->ep.maxpacket = i == 0 ? EP0_PACKETSIZE : EP_PACKETSIZE;
+       }

        list_del_init(&udc->ep[0].ep.ep_list);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ