]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/early_ioremap: print the starting physical address in __early_ioremap()
authorHou Wenlong <houwenlong.hwl@antgroup.com>
Fri, 9 Jan 2026 13:31:51 +0000 (21:31 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 27 Jan 2026 04:02:26 +0000 (20:02 -0800)
The debug WARN() printing occurs after the while loop, so the 'phys_addr'
reflects the last physical address rather than the actual starting
physical address, which is not useful for debugging.  To simplify, the
WARN() statement could be moved up before the loop instead of introducing
a new variable to record the original 'phys_addr' value.  Additionally,
swap the print order of 'slot_virt[slot]' and 'offset', as this will
enhance output readability.

Link: https://lkml.kernel.org/r/aa2d44c34f44c31b50285b7592ed4fd78d6f59ba.1767965415.git.houwenlong.hwl@antgroup.com
Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/early_ioremap.c

index ff35b84a7b5081a4e0e3ba29e7d4d5339b4e2e27..3fdde074c9da408f7a24291c35215e1f8505f7e3 100644 (file)
@@ -139,6 +139,9 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
        if (WARN_ON(nrpages > NR_FIX_BTMAPS))
                return NULL;
 
+       WARN(early_ioremap_debug, "%s(%pa, %08lx) [%d] => %08lx + %08lx\n",
+            __func__, &phys_addr, size, slot, slot_virt[slot], offset);
+
        /*
         * Ok, go for it..
         */
@@ -152,8 +155,6 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
                --idx;
                --nrpages;
        }
-       WARN(early_ioremap_debug, "%s(%pa, %08lx) [%d] => %08lx + %08lx\n",
-            __func__, &phys_addr, size, slot, offset, slot_virt[slot]);
 
        prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]);
        return prev_map[slot];