Commit c8b31cce45477dea51b3c65b2c0e12ea9cced9f0

Authored by Simon Glass
Committed by Bin Meng
1 parent d3e773613b

dm: core: Drop a few early returns

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>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Showing 1 changed file with 10 additions and 4 deletions Side-by-side Diff

drivers/core/uclass.c
... ... @@ -714,8 +714,11 @@
714 714 if (!dev->parent)
715 715 return 0;
716 716 uc_drv = dev->parent->uclass->uc_drv;
717   - if (uc_drv->child_pre_probe)
718   - return uc_drv->child_pre_probe(dev);
  717 + if (uc_drv->child_pre_probe) {
  718 + ret = uc_drv->child_pre_probe(dev);
  719 + if (ret)
  720 + return ret;
  721 + }
719 722  
720 723 return 0;
721 724 }
... ... @@ -735,8 +738,11 @@
735 738 }
736 739  
737 740 uc_drv = dev->uclass->uc_drv;
738   - if (uc_drv->post_probe)
739   - return uc_drv->post_probe(dev);
  741 + if (uc_drv->post_probe) {
  742 + ret = uc_drv->post_probe(dev);
  743 + if (ret)
  744 + return ret;
  745 + }
740 746  
741 747 return 0;
742 748 }