spl: mmc: Avoid size growth in spl_mmc_find_device() debug
authorSimon Glass <sjg@chromium.org>
Thu, 19 Dec 2024 18:28:49 +0000 (11:28 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 27 Dec 2024 21:16:10 +0000 (15:16 -0600)
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 <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
common/spl/spl_mmc.c

index 1f69659..fe42301 100644 (file)
@@ -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);