From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: [PATCH 1/2] usb: gadget: compress return logic into one line
Date: Sun, 9 Jul 2017 21:34:35 -0500 [thread overview]
Message-ID: <20170710023435.GA6257@embeddedgus> (raw)
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@embeddedor.com>
---
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
next reply other threads:[~2017-07-10 2:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 2:34 Gustavo A. R. Silva [this message]
2017-07-10 2:36 ` [PATCH 2/2] usb: gadget: use unsigned int instead of unsigned in usb_otg_descriptor_alloc() Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170710023435.GA6257@embeddedgus \
--to=garsilva@embeddedor.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.