All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 4/8] usb: squash lines for immediate return
Date: Tue,  6 Sep 2016 22:17:35 +0900	[thread overview]
Message-ID: <1473167860-27465-5-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1473167860-27465-1-git-send-email-yamada.masahiro@socionext.com>

This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v3: None

 common/usb.c                | 20 +++++++-------------
 common/usb_kbd.c            |  5 +----
 common/usb_storage.c        |  9 +++------
 drivers/usb/host/xhci-fsl.c |  7 +------
 4 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index b3ba487..15e1e4c 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -557,12 +557,10 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
 static int usb_get_descriptor(struct usb_device *dev, unsigned char type,
 			unsigned char index, void *buf, int size)
 {
-	int res;
-	res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-			USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
-			(type << 8) + index, 0,
-			buf, size, USB_CNTL_TIMEOUT);
-	return res;
+	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+			       USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
+			       (type << 8) + index, 0, buf, size,
+			       USB_CNTL_TIMEOUT);
 }
 
 /**********************************************************************
@@ -612,14 +610,10 @@ int usb_get_configuration_no(struct usb_device *dev, int cfgno,
  */
 static int usb_set_address(struct usb_device *dev)
 {
-	int res;
-
 	debug("set address %d\n", dev->devnum);
-	res = usb_control_msg(dev, usb_snddefctrl(dev),
-				USB_REQ_SET_ADDRESS, 0,
-				(dev->devnum), 0,
-				NULL, 0, USB_CNTL_TIMEOUT);
-	return res;
+
+	return usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS,
+			       0, (dev->devnum), 0, NULL, 0, USB_CNTL_TIMEOUT);
 }
 
 /********************************************************************
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 97f79f8..a9872a6 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -605,11 +605,8 @@ int usb_kbd_deregister(int force)
 static int usb_kbd_probe(struct udevice *dev)
 {
 	struct usb_device *udev = dev_get_parent_priv(dev);
-	int ret;
-
-	ret = probe_usb_keyboard(udev);
 
-	return ret;
+	return probe_usb_keyboard(udev);
 }
 
 static int usb_kbd_remove(struct udevice *dev)
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 7e6e52d..0345aa2 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -708,13 +708,10 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data *us)
 /* clear a stall on an endpoint - special for BBB devices */
 static int usb_stor_BBB_clear_endpt_stall(struct us_data *us, __u8 endpt)
 {
-	int result;
-
 	/* ENDPOINT_HALT = 0, so set value to 0 */
-	result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
-				USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT,
-				0, endpt, NULL, 0, USB_CNTL_TIMEOUT * 5);
-	return result;
+	return usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
+			       USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0,
+			       endpt, NULL, 0, USB_CNTL_TIMEOUT * 5);
 }
 
 static int usb_stor_BBB_transport(ccb *srb, struct us_data *us)
diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c
index bdcd4f1..6ff450c 100644
--- a/drivers/usb/host/xhci-fsl.c
+++ b/drivers/usb/host/xhci-fsl.c
@@ -129,15 +129,10 @@ static int xhci_fsl_probe(struct udevice *dev)
 static int xhci_fsl_remove(struct udevice *dev)
 {
 	struct xhci_fsl_priv *priv = dev_get_priv(dev);
-	int ret;
 
 	fsl_xhci_core_exit(&priv->ctx);
 
-	ret = xhci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return xhci_deregister(dev);
 }
 
 static const struct udevice_id xhci_usb_ids[] = {
-- 
1.9.1

  parent reply	other threads:[~2016-09-06 13:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 13:17 [U-Boot] [PATCH v3 0/8] Clean-up: squash lines for immediate return Masahiro Yamada
2016-09-06 13:17 ` [U-Boot] [PATCH v3 1/8] mmc: " Masahiro Yamada
2016-09-08 13:46   ` Jaehoon Chung
2016-09-24  2:27   ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-09-06 13:17 ` [U-Boot] [PATCH v3 2/8] video: " Masahiro Yamada
2016-09-06 14:23   ` Simon Glass
2016-09-06 17:25   ` Stephen Warren
2016-09-24  2:27   ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-09-06 13:17 ` [U-Boot] [PATCH v3 3/8] usb: replace ehci_*_remove() with usb_deregister() Masahiro Yamada
2016-09-06 17:27   ` Stephen Warren
2016-09-24  2:27   ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-09-06 13:17 ` Masahiro Yamada [this message]
2016-09-24  2:27   ` [U-Boot] [U-Boot, v3, 4/8] usb: squash lines for immediate return Tom Rini
2016-09-06 13:17 ` [U-Boot] [PATCH v3 5/8] x86: " Masahiro Yamada
2016-09-24  2:28   ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-09-06 13:17 ` [U-Boot] [PATCH v3 6/8] libfdt: simplify fdt_del_mem_rsv() Masahiro Yamada
2016-09-06 14:23   ` Simon Glass
2016-09-24  2:28   ` [U-Boot] [U-Boot,v3,6/8] " Tom Rini
2016-09-06 13:17 ` [U-Boot] [PATCH v3 7/8] arch, board: squash lines for immediate return Masahiro Yamada
2016-09-06 16:37   ` Minkyu Kang
2016-09-08 21:26   ` Angelo Dureghello
2016-09-24  2:28   ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-09-06 13:17 ` [U-Boot] [PATCH v3 8/8] drivers: " Masahiro Yamada
2016-09-24  2:28   ` [U-Boot] [U-Boot, v3, " Tom Rini

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=1473167860-27465-5-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=u-boot@lists.denx.de \
    /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.