Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295AbdGJCek (ORCPT ); Sun, 9 Jul 2017 22:34:40 -0400 Received: from gateway22.websitewelcome.com ([192.185.47.65]:47507 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753056AbdGJCei (ORCPT ); Sun, 9 Jul 2017 22:34:38 -0400 Date: Sun, 9 Jul 2017 21:34:35 -0500 From: "Gustavo A. R. Silva" To: Felipe Balbi , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH 1/2] usb: gadget: compress return logic into one line Message-ID: <20170710023435.GA6257@embeddedgus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.152.176 X-Exim-ID: 1dUOWy-004Dkx-1d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.152.176]:45932 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 15 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 45 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 --- drivers/usb/gadget/config.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index 17a6077..23bfa7d 100644 --- a/drivers/usb/gadget/config.c +++ b/drivers/usb/gadget/config.c @@ -207,7 +207,6 @@ EXPORT_SYMBOL_GPL(usb_free_all_descriptors); struct usb_descriptor_header *usb_otg_descriptor_alloc( struct usb_gadget *gadget) { - struct usb_descriptor_header *otg_desc; unsigned length = 0; if (gadget->otg_caps && (gadget->otg_caps->otg_rev >= 0x0200)) @@ -215,8 +214,7 @@ struct usb_descriptor_header *usb_otg_descriptor_alloc( else length = sizeof(struct usb_otg_descriptor); - otg_desc = kzalloc(length, GFP_KERNEL); - return otg_desc; + return kzalloc(length, GFP_KERNEL); } EXPORT_SYMBOL_GPL(usb_otg_descriptor_alloc); -- 2.5.0