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>] [day] [month] [year] [list]
Message-ID: <20170710024736.GA10160@embeddedgus>
Date:   Sun, 9 Jul 2017 21:47:36 -0500
From:   "Gustavo A. R. Silva" <garsilva@...eddedor.com>
To:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Subject: [PATCH] usb: gadget: legacy: dbgp: compress return logic into one
 line

Simplify return logic to avoid unnecessary variable declaration
and assignment.

This issue was detected using Coccinelle and the following
semantic patch:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
---
 drivers/usb/gadget/legacy/dbgp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c
index 99ca3da..f14a5d7 100644
--- a/drivers/usb/gadget/legacy/dbgp.c
+++ b/drivers/usb/gadget/legacy/dbgp.c
@@ -165,10 +165,9 @@ static int dbgp_enable_ep_req(struct usb_ep *ep)
 
 static int __enable_ep(struct usb_ep *ep, struct usb_endpoint_descriptor *desc)
 {
-	int err;
 	ep->desc = desc;
-	err = usb_ep_enable(ep);
-	return err;
+
+	return usb_ep_enable(ep);
 }
 
 static int dbgp_enable_ep(void)
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ