]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if we won't print...
authorMarek Behún <kabel@kernel.org>
Tue, 18 Jun 2024 15:34:25 +0000 (17:34 +0200)
committerStefan Roese <sr@denx.de>
Mon, 8 Jul 2024 06:20:58 +0000 (08:20 +0200)
Return from ddr3_tip_print_log() early if we won't print anything
anyway.

This way the compiler can optimize away the VALIDATE_IF_ACTIVE() calls
in the for-loop, so if the SILENT_LIB macro is defined, no code is
generated for the rest of the function, which saves some space.

Signed-off-by: Marek Behún <kabel@kernel.org>
drivers/ddr/marvell/a38x/ddr3_debug.c

index 9e499cfb9925e7f512c86f122c96072d1c56d0a5..0374a8438786c67f0780e4dc8b1f7cb61a929cef 100644 (file)
@@ -399,6 +399,15 @@ int ddr3_tip_print_log(u32 dev_num, u32 mem_addr)
        }
 #endif /* DDR_VIEWER_TOOL */
 
+       /* return early if we won't print anything anyway */
+       if (
+#if defined(SILENT_LIB)
+           1 ||
+#endif
+           debug_training < DEBUG_LEVEL_INFO) {
+               return MV_OK;
+       }
+
        for (if_id = 0; if_id <= MAX_INTERFACE_NUM - 1; if_id++) {
                VALIDATE_IF_ACTIVE(tm->if_act_mask, if_id);