All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return
@ 2016-09-05 13:38 Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 1/7] mmc: " Masahiro Yamada
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

ret = [expression];
if (ret)
        return ret;

return 0;

...  is equivalent to:

return [expression];

First, I sent a tree-wide patch:
http://patchwork.ozlabs.org/patch/665199/

In the review of v1, Stephen suggested that
twee-wide conversion with something like Coccinelle
can break code uniformity.
I took a closer look once again, I found many hunks
we should not change.

So, here is v2.

I limited this refactoring to cases, I think, really
beneficial.
(Mostly, they well be simple wrappers with this series.)

I also split patches per-subsystem
so that custodians can easily review and issue Acked-by
(or NACK if they found no good reason to change).



Masahiro Yamada (7):
  mmc: squash lines for immediate return
  video: squash lines for immediate return
  usb: squash lines for immediate return
  x86: squash lines for immediate return
  samsung: squash lines for immediate return
  power: squash lines for immediate return
  libfdt: simplify fdt_del_mem_rsv()

 arch/x86/cpu/baytrail/valleyview.c |  8 +-------
 arch/x86/cpu/ivybridge/ivybridge.c |  8 +-------
 arch/x86/cpu/qemu/qemu.c           |  8 +-------
 arch/x86/cpu/queensbay/tnc.c       |  8 +-------
 board/samsung/goni/goni.c          |  8 +-------
 drivers/mmc/atmel_sdhci.c          |  7 +------
 drivers/mmc/exynos_dw_mmc.c        |  7 +------
 drivers/mmc/mmc_boot.c             | 28 ++++++++--------------------
 drivers/mmc/msm_sdhci.c            |  7 +------
 drivers/mmc/rockchip_dw_mmc.c      |  7 +------
 drivers/mmc/rockchip_sdhci.c       |  7 +------
 drivers/mmc/sandbox_mmc.c          |  7 +------
 drivers/mmc/zynq_sdhci.c           |  7 +------
 drivers/power/axp809.c             |  8 +-------
 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 +------
 drivers/video/bridge/ptn3460.c     |  7 +------
 drivers/video/tegra124/display.c   |  8 +-------
 drivers/video/vidconsole-uclass.c  |  6 +-----
 lib/libfdt/fdt_rw.c                |  6 +-----
 25 files changed, 32 insertions(+), 175 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 1/7] mmc: squash lines for immediate return
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 2/7] video: " Masahiro Yamada
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

These functions can be much simpler by squashing lines for immediate
return.

For *_bind() callbacks, they will be a simple wrapper function of an
upper-level bind API.

For mmc_set_{boot_bus_width,part_conf}, they will be a wrapper of
mmc_switch().

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

 drivers/mmc/atmel_sdhci.c     |  7 +------
 drivers/mmc/exynos_dw_mmc.c   |  7 +------
 drivers/mmc/mmc_boot.c        | 28 ++++++++--------------------
 drivers/mmc/msm_sdhci.c       |  7 +------
 drivers/mmc/rockchip_dw_mmc.c |  7 +------
 drivers/mmc/rockchip_sdhci.c  |  7 +------
 drivers/mmc/sandbox_mmc.c     |  7 +------
 drivers/mmc/zynq_sdhci.c      |  7 +------
 8 files changed, 15 insertions(+), 62 deletions(-)

diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c
index dd6bd33..d8f8087 100644
--- a/drivers/mmc/atmel_sdhci.c
+++ b/drivers/mmc/atmel_sdhci.c
@@ -136,13 +136,8 @@ static int atmel_sdhci_probe(struct udevice *dev)
 static int atmel_sdhci_bind(struct udevice *dev)
 {
 	struct atmel_sdhci_plat *plat = dev_get_platdata(dev);
-	int ret;
 
-	ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id atmel_sdhci_ids[] = {
diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index 57271f1..568fed7 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -284,13 +284,8 @@ static int exynos_dwmmc_probe(struct udevice *dev)
 static int exynos_dwmmc_bind(struct udevice *dev)
 {
 	struct exynos_mmc_plat *plat = dev_get_platdata(dev);
-	int ret;
 
-	ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return dwmci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id exynos_dwmmc_ids[] = {
diff --git a/drivers/mmc/mmc_boot.c b/drivers/mmc/mmc_boot.c
index 756a982..ac6f56f 100644
--- a/drivers/mmc/mmc_boot.c
+++ b/drivers/mmc/mmc_boot.c
@@ -85,16 +85,10 @@ int mmc_boot_partition_size_change(struct mmc *mmc, unsigned long bootsize,
  */
 int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode)
 {
-	int err;
-
-	err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_BUS_WIDTH,
-			 EXT_CSD_BOOT_BUS_WIDTH_MODE(mode) |
-			 EXT_CSD_BOOT_BUS_WIDTH_RESET(reset) |
-			 EXT_CSD_BOOT_BUS_WIDTH_WIDTH(width));
-
-	if (err)
-		return err;
-	return 0;
+	return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_BUS_WIDTH,
+			  EXT_CSD_BOOT_BUS_WIDTH_MODE(mode) |
+			  EXT_CSD_BOOT_BUS_WIDTH_RESET(reset) |
+			  EXT_CSD_BOOT_BUS_WIDTH_WIDTH(width));
 }
 
 /*
@@ -106,16 +100,10 @@ int mmc_set_boot_bus_width(struct mmc *mmc, u8 width, u8 reset, u8 mode)
  */
 int mmc_set_part_conf(struct mmc *mmc, u8 ack, u8 part_num, u8 access)
 {
-	int err;
-
-	err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
-			 EXT_CSD_BOOT_ACK(ack) |
-			 EXT_CSD_BOOT_PART_NUM(part_num) |
-			 EXT_CSD_PARTITION_ACCESS(access));
-
-	if (err)
-		return err;
-	return 0;
+	return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
+			  EXT_CSD_BOOT_ACK(ack) |
+			  EXT_CSD_BOOT_PART_NUM(part_num) |
+			  EXT_CSD_PARTITION_ACCESS(access));
 }
 
 /*
diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index 8d4399e..1b82991 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -190,13 +190,8 @@ static int msm_ofdata_to_platdata(struct udevice *dev)
 static int msm_sdc_bind(struct udevice *dev)
 {
 	struct msm_sdhc_plat *plat = dev_get_platdata(dev);
-	int ret;
 
-	ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id msm_mmc_ids[] = {
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index 020a59b..859760b 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -142,13 +142,8 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 static int rockchip_dwmmc_bind(struct udevice *dev)
 {
 	struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
-	int ret;
 
-	ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return dwmci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id rockchip_dwmmc_ids[] = {
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
index 624029b..c56e1a3 100644
--- a/drivers/mmc/rockchip_sdhci.c
+++ b/drivers/mmc/rockchip_sdhci.c
@@ -62,13 +62,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
 static int rockchip_sdhci_bind(struct udevice *dev)
 {
 	struct rockchip_sdhc_plat *plat = dev_get_platdata(dev);
-	int ret;
 
-	ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id arasan_sdhci_ids[] = {
diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index 5f1333b..fdb29a5 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -112,7 +112,6 @@ int sandbox_mmc_bind(struct udevice *dev)
 {
 	struct sandbox_mmc_plat *plat = dev_get_platdata(dev);
 	struct mmc_config *cfg = &plat->cfg;
-	int ret;
 
 	cfg->name = dev->name;
 	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_8BIT;
@@ -121,11 +120,7 @@ int sandbox_mmc_bind(struct udevice *dev)
 	cfg->f_max = 52000000;
 	cfg->b_max = U32_MAX;
 
-	ret = mmc_bind(dev, &plat->mmc, cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_bind(dev, &plat->mmc, cfg);
 }
 
 int sandbox_mmc_unbind(struct udevice *dev)
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 3815b94..b991102 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -63,13 +63,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
 static int arasan_sdhci_bind(struct udevice *dev)
 {
 	struct arasan_sdhci_plat *plat = dev_get_platdata(dev);
-	int ret;
 
-	ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
-	if (ret)
-		return ret;
-
-	return 0;
+	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id arasan_sdhci_ids[] = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 2/7] video: squash lines for immediate return
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 1/7] mmc: " Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  2016-09-05 17:12   ` Anatolij Gustschin
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 3/7] usb: " Masahiro Yamada
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

ptn3460_attach() and display_update_config_from_edid() will become
a simple wrapper function.

For vidconsole_post_probe(), it is common coding style to let a
probe method return the value of a resister function.

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

 drivers/video/bridge/ptn3460.c    | 7 +------
 drivers/video/tegra124/display.c  | 8 +-------
 drivers/video/vidconsole-uclass.c | 6 +-----
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/video/bridge/ptn3460.c b/drivers/video/bridge/ptn3460.c
index 2e2ae7c..f9d3720 100644
--- a/drivers/video/bridge/ptn3460.c
+++ b/drivers/video/bridge/ptn3460.c
@@ -11,14 +11,9 @@
 
 static int ptn3460_attach(struct udevice *dev)
 {
-	int ret;
-
 	debug("%s: %s\n", __func__, dev->name);
-	ret = video_bridge_set_active(dev, true);
-	if (ret)
-		return ret;
 
-	return 0;
+	return video_bridge_set_active(dev, true);
 }
 
 struct video_bridge_ops ptn3460_ops = {
diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index 2f1f0df..d8999c3 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -326,13 +326,7 @@ static int display_update_config_from_edid(struct udevice *dp_dev,
 					   int *panel_bppp,
 					   struct display_timing *timing)
 {
-	int ret;
-
-	ret = display_read_timing(dp_dev, timing);
-	if (ret)
-		return ret;
-
-	return 0;
+	return display_read_timing(dp_dev, timing);
 }
 
 static int display_init(struct udevice *dev, void *lcdbase,
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index c8cc05e..e9a90b1 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -190,7 +190,6 @@ static int vidconsole_post_probe(struct udevice *dev)
 {
 	struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
 	struct stdio_dev *sdev = &priv->sdev;
-	int ret;
 
 	if (!priv->tab_width_frac)
 		priv->tab_width_frac = VID_TO_POS(priv->x_charsize) * 8;
@@ -206,11 +205,8 @@ static int vidconsole_post_probe(struct udevice *dev)
 	sdev->putc = vidconsole_putc;
 	sdev->puts = vidconsole_puts;
 	sdev->priv = dev;
-	ret = stdio_register(sdev);
-	if (ret)
-		return ret;
 
-	return 0;
+	return stdio_register(sdev);
 }
 
 UCLASS_DRIVER(vidconsole) = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 3/7] usb: squash lines for immediate return
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 1/7] mmc: " Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 2/7] video: " Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 4/7] x86: " Masahiro Yamada
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Masahiro Yamada <yamada.masahiro@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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 4/7] x86: squash lines for immediate return
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
                   ` (2 preceding siblings ...)
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 3/7] usb: " Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  2016-09-06  1:40   ` Bin Meng
  2016-09-06  2:03   ` Simon Glass
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 5/7] samsung: " Masahiro Yamada
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

arch_cpu_init() can be simpler by this refactoring.

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

 arch/x86/cpu/baytrail/valleyview.c | 8 +-------
 arch/x86/cpu/ivybridge/ivybridge.c | 8 +-------
 arch/x86/cpu/qemu/qemu.c           | 8 +-------
 arch/x86/cpu/queensbay/tnc.c       | 8 +-------
 4 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/arch/x86/cpu/baytrail/valleyview.c b/arch/x86/cpu/baytrail/valleyview.c
index b31f24e..b312d9f 100644
--- a/arch/x86/cpu/baytrail/valleyview.c
+++ b/arch/x86/cpu/baytrail/valleyview.c
@@ -25,15 +25,9 @@ int cpu_mmc_init(bd_t *bis)
 #ifndef CONFIG_EFI_APP
 int arch_cpu_init(void)
 {
-	int ret;
-
 	post_code(POST_CPU_INIT);
 
-	ret = x86_cpu_init_f();
-	if (ret)
-		return ret;
-
-	return 0;
+	return x86_cpu_init_f();
 }
 
 int arch_misc_init(void)
diff --git a/arch/x86/cpu/ivybridge/ivybridge.c b/arch/x86/cpu/ivybridge/ivybridge.c
index c770b53..e817eb9 100644
--- a/arch/x86/cpu/ivybridge/ivybridge.c
+++ b/arch/x86/cpu/ivybridge/ivybridge.c
@@ -10,13 +10,7 @@
 
 int arch_cpu_init(void)
 {
-	int ret;
-
 	post_code(POST_CPU_INIT);
 
-	ret = x86_cpu_init_f();
-	if (ret)
-		return ret;
-
-	return 0;
+	return x86_cpu_init_f();
 }
diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
index 680e558..c3092f2 100644
--- a/arch/x86/cpu/qemu/qemu.c
+++ b/arch/x86/cpu/qemu/qemu.c
@@ -139,15 +139,9 @@ static void qemu_chipset_init(void)
 
 int arch_cpu_init(void)
 {
-	int ret;
-
 	post_code(POST_CPU_INIT);
 
-	ret = x86_cpu_init_f();
-	if (ret)
-		return ret;
-
-	return 0;
+	return x86_cpu_init_f();
 }
 
 #ifndef CONFIG_EFI_STUB
diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
index b226e4c..f307c62 100644
--- a/arch/x86/cpu/queensbay/tnc.c
+++ b/arch/x86/cpu/queensbay/tnc.c
@@ -94,15 +94,9 @@ static int __maybe_unused disable_igd(void)
 
 int arch_cpu_init(void)
 {
-	int ret;
-
 	post_code(POST_CPU_INIT);
 
-	ret = x86_cpu_init_f();
-	if (ret)
-		return ret;
-
-	return 0;
+	return x86_cpu_init_f();
 }
 
 int arch_early_init_r(void)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 5/7] samsung: squash lines for immediate return
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
                   ` (3 preceding siblings ...)
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 4/7] x86: " Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 6/7] power: " Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 7/7] libfdt: simplify fdt_del_mem_rsv() Masahiro Yamada
  6 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

Currently, this function is just a wrapper of pmic_init().

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

 board/samsung/goni/goni.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 1600568..e8329bb 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -45,17 +45,11 @@ void i2c_init_board(void)
 
 int power_init_board(void)
 {
-	int ret;
-
 	/*
 	 * For PMIC the I2C bus is named as I2C5, but it is connected
 	 * to logical I2C adapter 0
 	 */
-	ret = pmic_init(I2C_0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return pmic_init(I2C_0);
 }
 
 int dram_init(void)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 6/7] power: squash lines for immediate return
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
                   ` (4 preceding siblings ...)
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 5/7] samsung: " Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 7/7] libfdt: simplify fdt_del_mem_rsv() Masahiro Yamada
  6 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

Currently, this function is just a wrapper of pmic_bus_init().

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

 drivers/power/axp809.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/power/axp809.c b/drivers/power/axp809.c
index c8b76cf..c5b608d 100644
--- a/drivers/power/axp809.c
+++ b/drivers/power/axp809.c
@@ -217,13 +217,7 @@ int axp_set_sw(bool on)
 
 int axp_init(void)
 {
-	int ret;
-
-	ret = pmic_bus_init();
-	if (ret)
-		return ret;
-
-	return 0;
+	return pmic_bus_init();
 }
 
 int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 7/7] libfdt: simplify fdt_del_mem_rsv()
  2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
                   ` (5 preceding siblings ...)
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 6/7] power: " Masahiro Yamada
@ 2016-09-05 13:38 ` Masahiro Yamada
  6 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-05 13:38 UTC (permalink / raw)
  To: u-boot

The variable "err" is unneeded.

[ Backport from Device Tree Compiler
  commit: 36fd7331fb11276c09a6affc0d8cd4977f2fe100 ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---

 lib/libfdt/fdt_rw.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c
index e7321cc..47447b2 100644
--- a/lib/libfdt/fdt_rw.c
+++ b/lib/libfdt/fdt_rw.c
@@ -148,17 +148,13 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
 int fdt_del_mem_rsv(void *fdt, int n)
 {
 	struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
-	int err;
 
 	FDT_RW_CHECK_HEADER(fdt);
 
 	if (n >= fdt_num_mem_rsv(fdt))
 		return -FDT_ERR_NOTFOUND;
 
-	err = _fdt_splice_mem_rsv(fdt, re, 1, 0);
-	if (err)
-		return err;
-	return 0;
+	return _fdt_splice_mem_rsv(fdt, re, 1, 0);
 }
 
 static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 2/7] video: squash lines for immediate return
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 2/7] video: " Masahiro Yamada
@ 2016-09-05 17:12   ` Anatolij Gustschin
  2016-09-06  1:09     ` Masahiro Yamada
  0 siblings, 1 reply; 12+ messages in thread
From: Anatolij Gustschin @ 2016-09-05 17:12 UTC (permalink / raw)
  To: u-boot

On Mon,  5 Sep 2016 22:38:38 +0900
Masahiro Yamada yamada.masahiro at socionext.com wrote:

> ptn3460_attach() and display_update_config_from_edid() will become
> a simple wrapper function.
> 
> For vidconsole_post_probe(), it is common coding style to let a
> probe method return the value of a resister function.

s/resister/register/

otherwise

Acked-by: Anatolij Gustschin <agust@denx.de>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 2/7] video: squash lines for immediate return
  2016-09-05 17:12   ` Anatolij Gustschin
@ 2016-09-06  1:09     ` Masahiro Yamada
  0 siblings, 0 replies; 12+ messages in thread
From: Masahiro Yamada @ 2016-09-06  1:09 UTC (permalink / raw)
  To: u-boot

2016-09-06 2:12 GMT+09:00 Anatolij Gustschin <agust@denx.de>:
> On Mon,  5 Sep 2016 22:38:38 +0900
> Masahiro Yamada yamada.masahiro at socionext.com wrote:
>
>> ptn3460_attach() and display_update_config_from_edid() will become
>> a simple wrapper function.
>>
>> For vidconsole_post_probe(), it is common coding style to let a
>> probe method return the value of a resister function.
>
> s/resister/register/
>
> otherwise
>
> Acked-by: Anatolij Gustschin <agust@denx.de>


I will send v3.  Thanks!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 4/7] x86: squash lines for immediate return
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 4/7] x86: " Masahiro Yamada
@ 2016-09-06  1:40   ` Bin Meng
  2016-09-06  2:03   ` Simon Glass
  1 sibling, 0 replies; 12+ messages in thread
From: Bin Meng @ 2016-09-06  1:40 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 5, 2016 at 9:38 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> arch_cpu_init() can be simpler by this refactoring.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  arch/x86/cpu/baytrail/valleyview.c | 8 +-------
>  arch/x86/cpu/ivybridge/ivybridge.c | 8 +-------
>  arch/x86/cpu/qemu/qemu.c           | 8 +-------
>  arch/x86/cpu/queensbay/tnc.c       | 8 +-------
>  4 files changed, 4 insertions(+), 28 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2 4/7] x86: squash lines for immediate return
  2016-09-05 13:38 ` [U-Boot] [PATCH v2 4/7] x86: " Masahiro Yamada
  2016-09-06  1:40   ` Bin Meng
@ 2016-09-06  2:03   ` Simon Glass
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2016-09-06  2:03 UTC (permalink / raw)
  To: u-boot

On 5 September 2016 at 07:38, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> arch_cpu_init() can be simpler by this refactoring.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  arch/x86/cpu/baytrail/valleyview.c | 8 +-------
>  arch/x86/cpu/ivybridge/ivybridge.c | 8 +-------
>  arch/x86/cpu/qemu/qemu.c           | 8 +-------
>  arch/x86/cpu/queensbay/tnc.c       | 8 +-------
>  4 files changed, 4 insertions(+), 28 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-09-06  2:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-05 13:38 [U-Boot] [PATCH v2 0/7] Clean-up: squash lines for immediate return Masahiro Yamada
2016-09-05 13:38 ` [U-Boot] [PATCH v2 1/7] mmc: " Masahiro Yamada
2016-09-05 13:38 ` [U-Boot] [PATCH v2 2/7] video: " Masahiro Yamada
2016-09-05 17:12   ` Anatolij Gustschin
2016-09-06  1:09     ` Masahiro Yamada
2016-09-05 13:38 ` [U-Boot] [PATCH v2 3/7] usb: " Masahiro Yamada
2016-09-05 13:38 ` [U-Boot] [PATCH v2 4/7] x86: " Masahiro Yamada
2016-09-06  1:40   ` Bin Meng
2016-09-06  2:03   ` Simon Glass
2016-09-05 13:38 ` [U-Boot] [PATCH v2 5/7] samsung: " Masahiro Yamada
2016-09-05 13:38 ` [U-Boot] [PATCH v2 6/7] power: " Masahiro Yamada
2016-09-05 13:38 ` [U-Boot] [PATCH v2 7/7] libfdt: simplify fdt_del_mem_rsv() Masahiro Yamada

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.