[U-Boot] [PATCH v2 3/7] usb: squash lines for immediate return

Masahiro Yamada yamada.masahiro at socionext.com
Mon Sep 5 15:38:39 CEST 2016


ehci_*_remove() is just a wrapper of ehci_deregister().
xhci_fsl_remove() can be simpler as well.

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

 drivers/usb/host/ehci-atmel.c   | 8 +-------
 drivers/usb/host/ehci-fsl.c     | 8 +-------
 drivers/usb/host/ehci-marvell.c | 8 +-------
 drivers/usb/host/ehci-mx6.c     | 8 +-------
 drivers/usb/host/ehci-pci.c     | 8 +-------
 drivers/usb/host/ehci-zynq.c    | 8 +-------
 drivers/usb/host/xhci-fsl.c     | 7 +------
 7 files changed, 7 insertions(+), 48 deletions(-)

diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index d65bbe9..cd460a2 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -130,13 +130,7 @@ static int ehci_atmel_probe(struct udevice *dev)
 
 static int ehci_atmel_remove(struct udevice *dev)
 {
-	int ret;
-
-	ret = ehci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return ehci_deregister(dev);
 }
 
 static const struct udevice_id ehci_usb_ids[] = {
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index f5e3ae7..fb65480 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -120,13 +120,7 @@ static int ehci_fsl_probe(struct udevice *dev)
 
 static int ehci_fsl_remove(struct udevice *dev)
 {
-	int ret;
-
-	ret = ehci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return ehci_deregister(dev);
 }
 
 static const struct udevice_id ehci_usb_ids[] = {
diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c
index 5b0f46a..2ecf282 100644
--- a/drivers/usb/host/ehci-marvell.c
+++ b/drivers/usb/host/ehci-marvell.c
@@ -96,13 +96,7 @@ static int ehci_mvebu_probe(struct udevice *dev)
 
 static int ehci_mvebu_remove(struct udevice *dev)
 {
-	int ret;
-
-	ret = ehci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return ehci_deregister(dev);
 }
 
 static const struct udevice_id ehci_usb_ids[] = {
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 602fec5..a785bb8 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -453,13 +453,7 @@ static int ehci_usb_probe(struct udevice *dev)
 
 static int ehci_usb_remove(struct udevice *dev)
 {
-	int ret;
-
-	ret = ehci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return ehci_deregister(dev);
 }
 
 static const struct udevice_id mx6_usb_ids[] = {
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index f21a1fa..2228f91 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -128,13 +128,7 @@ static int ehci_pci_probe(struct udevice *dev)
 
 static int ehci_pci_remove(struct udevice *dev)
 {
-	int ret;
-
-	ret = ehci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return ehci_deregister(dev);
 }
 
 static const struct udevice_id ehci_pci_ids[] = {
diff --git a/drivers/usb/host/ehci-zynq.c b/drivers/usb/host/ehci-zynq.c
index 76642cd..1fe00bfe 100644
--- a/drivers/usb/host/ehci-zynq.c
+++ b/drivers/usb/host/ehci-zynq.c
@@ -75,13 +75,7 @@ static int ehci_zynq_probe(struct udevice *dev)
 
 static int ehci_zynq_remove(struct udevice *dev)
 {
-	int ret;
-
-	ret = ehci_deregister(dev);
-	if (ret)
-		return ret;
-
-	return 0;
+	return ehci_deregister(dev);
 }
 
 static const struct udevice_id ehci_zynq_ids[] = {
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



More information about the U-Boot mailing list