diff mbox series

[U-Boot,003/126] dm: core: Drop a few early returns

Message ID 20190925145750.200592-4-sjg@chromium.org
State Accepted
Commit c8b31cce45477dea51b3c65b2c0e12ea9cced9f0
Delegated to: Bin Meng
Headers show
Series x86: Add initial support for apollolake | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:55 p.m. UTC
Two functions in this file return early for no good reason. Adjust the
code to match the standard DM style of returning 0 at the end of the
function on success.

Oddly enough this save 12 bytes of code size on ARM.

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

 drivers/core/uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Bin Meng Oct. 3, 2019, 12:47 p.m. UTC | #1
On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
>
> Two functions in this file return early for no good reason. Adjust the
> code to match the standard DM style of returning 0 at the end of the
> function on success.
>
> Oddly enough this save 12 bytes of code size on ARM.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/core/uclass.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Oct. 6, 2019, 9:15 a.m. UTC | #2
On Thu, Oct 3, 2019 at 8:47 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > Two functions in this file return early for no good reason. Adjust the
> > code to match the standard DM style of returning 0 at the end of the
> > function on success.
> >
> > Oddly enough this save 12 bytes of code size on ARM.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  drivers/core/uclass.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86/next, thanks!
diff mbox series

Patch

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index b33296542f6..af575bbeb72 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -714,8 +714,11 @@  int uclass_pre_probe_device(struct udevice *dev)
 	if (!dev->parent)
 		return 0;
 	uc_drv = dev->parent->uclass->uc_drv;
-	if (uc_drv->child_pre_probe)
-		return uc_drv->child_pre_probe(dev);
+	if (uc_drv->child_pre_probe) {
+		ret = uc_drv->child_pre_probe(dev);
+		if (ret)
+			return ret;
+	}
 
 	return 0;
 }
@@ -735,8 +738,11 @@  int uclass_post_probe_device(struct udevice *dev)
 	}
 
 	uc_drv = dev->uclass->uc_drv;
-	if (uc_drv->post_probe)
-		return uc_drv->post_probe(dev);
+	if (uc_drv->post_probe) {
+		ret = uc_drv->post_probe(dev);
+		if (ret)
+			return ret;
+	}
 
 	return 0;
 }