All of lore.kernel.org
 help / color / mirror / Atom feed
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] usb: gadget: fusb300_udc: compress return logic into one line
Date: Sun, 9 Jul 2017 22:10:55 -0500	[thread overview]
Message-ID: <20170710031054.GA16519@embeddedgus> (raw)

Simplify return logic to avoid unnecessary variable declaration
and assignment.

These issues were 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/udc/fusb300_udc.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c
index e0c1b00..8738f03 100644
--- a/drivers/usb/gadget/udc/fusb300_udc.c
+++ b/drivers/usb/gadget/udc/fusb300_udc.c
@@ -659,22 +659,16 @@ static void fusb300_rdfifo(struct fusb300_ep *ep,
 
 static u8 fusb300_get_epnstall(struct fusb300 *fusb300, u8 ep)
 {
-	u8 value;
 	u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_EPSET0(ep));
 
-	value = reg & FUSB300_EPSET0_STL;
-
-	return value;
+	return reg & FUSB300_EPSET0_STL;
 }
 
 static u8 fusb300_get_cxstall(struct fusb300 *fusb300)
 {
-	u8 value;
 	u32 reg = ioread32(fusb300->reg + FUSB300_OFFSET_CSR);
 
-	value = (reg & FUSB300_CSR_STL) >> 1;
-
-	return value;
+	return (reg & FUSB300_CSR_STL) >> 1;
 }
 
 static void request_error(struct fusb300 *fusb300)
-- 
2.5.0

                 reply	other threads:[~2017-07-10  3:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170710031054.GA16519@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.