The for() loop ends up being in the code even if the log_debug() does
nothing. Add a condition to fix this.

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

(no changes since v3)

Changes in v3:
- Add new patch to avoid size growth in spl_mmc_find_device() debug

 common/spl/spl_mmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 1f696593216..fe4230170a0 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -81,8 +81,10 @@ static int spl_mmc_find_device(struct mmc **mmcp, int 
mmc_dev)
        struct uclass *uc;
 
        log_debug("Selecting MMC dev %d; seqs:\n", mmc_dev);
-       uclass_id_foreach_dev(UCLASS_MMC, dev, uc)
-               log_debug("%d: %s\n", dev_seq(dev), dev->name);
+       if (_LOG_DEBUG) {
+               uclass_id_foreach_dev(UCLASS_MMC, dev, uc)
+                       log_debug("%d: %s\n", dev_seq(dev), dev->name);
+       }
        ret = mmc_init_device(mmc_dev);
 #else
        ret = mmc_initialize(NULL);
-- 
2.34.1

Reply via email to