提交 b5b8d8d8 编写于 作者: N Nathan Chancellor 提交者: Zheng Zengkai

MIPS: Use address-of operator on section symbols

stable inclusion
from stable-v5.10.116
commit 7648f42d1a6241111078cd3f237086f998e63027
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L64K

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7648f42d1a6241111078cd3f237086f998e63027

--------------------------------

commit d422c6c0 upstream.

When building xway_defconfig with clang:

arch/mips/lantiq/prom.c:82:23: error: array comparison always evaluates
to true [-Werror,-Wtautological-compare]
        else if (__dtb_start != __dtb_end)
                             ^
1 error generated.

These are not true arrays, they are linker defined symbols, which are
just addresses. Using the address of operator silences the warning
and does not change the resulting assembly with either clang/ld.lld
or gcc/ld (tested with diff + objdump -Dr). Do the same thing across
the entire MIPS subsystem to ensure there are no more warnings around
this type of comparison.

Link: https://github.com/ClangBuiltLinux/linux/issues/1232Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 110b4db0
...@@ -167,7 +167,7 @@ void __init plat_mem_setup(void) ...@@ -167,7 +167,7 @@ void __init plat_mem_setup(void)
dtb = phys_to_virt(fw_arg2); dtb = phys_to_virt(fw_arg2);
else if (fw_passed_dtb) /* UHI interface or appended dtb */ else if (fw_passed_dtb) /* UHI interface or appended dtb */
dtb = (void *)fw_passed_dtb; dtb = (void *)fw_passed_dtb;
else if (__dtb_start != __dtb_end) else if (&__dtb_start != &__dtb_end)
dtb = (void *)__dtb_start; dtb = (void *)__dtb_start;
else else
panic("no dtb found"); panic("no dtb found");
......
...@@ -79,7 +79,7 @@ void __init plat_mem_setup(void) ...@@ -79,7 +79,7 @@ void __init plat_mem_setup(void)
if (fw_passed_dtb) /* UHI interface */ if (fw_passed_dtb) /* UHI interface */
dtb = (void *)fw_passed_dtb; dtb = (void *)fw_passed_dtb;
else if (__dtb_start != __dtb_end) else if (&__dtb_start != &__dtb_end)
dtb = (void *)__dtb_start; dtb = (void *)__dtb_start;
else else
panic("no dtb found"); panic("no dtb found");
......
...@@ -28,7 +28,7 @@ static ulong get_fdtaddr(void) ...@@ -28,7 +28,7 @@ static ulong get_fdtaddr(void)
if (fw_passed_dtb && !fw_arg2 && !fw_arg3) if (fw_passed_dtb && !fw_arg2 && !fw_arg3)
return (ulong)fw_passed_dtb; return (ulong)fw_passed_dtb;
if (__dtb_start < __dtb_end) if (&__dtb_start < &__dtb_end)
ftaddr = (ulong)__dtb_start; ftaddr = (ulong)__dtb_start;
return ftaddr; return ftaddr;
......
...@@ -77,7 +77,7 @@ void __init plat_mem_setup(void) ...@@ -77,7 +77,7 @@ void __init plat_mem_setup(void)
*/ */
if (fw_passed_dtb) if (fw_passed_dtb)
dtb = (void *)fw_passed_dtb; dtb = (void *)fw_passed_dtb;
else if (__dtb_start != __dtb_end) else if (&__dtb_start != &__dtb_end)
dtb = (void *)__dtb_start; dtb = (void *)__dtb_start;
__dt_setup_arch(dtb); __dt_setup_arch(dtb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册