diff mbox series

realtek: fix gcc-12 build with -Werror=array-compare

Message ID 20220619135927.3759442-1-bjorn@mork.no
State Accepted
Delegated to: Sander Vanheule
Headers show
Series realtek: fix gcc-12 build with -Werror=array-compare | expand

Commit Message

Bjørn Mork June 19, 2022, 1:59 p.m. UTC
Removing this gcc-12 error:

arch/mips/rtl838x/setup.c:64:30: error: comparison between two arrays [-Werror=array-compare]
   64 |         else if (__dtb_start != __dtb_end)

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
Kind of stupid....

But this is how similar fallout has been fixed in mainline AFAICS. For
example commit ca831f29f8f2 ("mm: page_alloc: fix building error on
-Werror=array-compare")

 target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sander Vanheule June 22, 2022, 4:56 p.m. UTC | #1
On Sun, 2022-06-19 at 15:59 +0200, Bjørn Mork wrote:
> Removing this gcc-12 error:
> 
> arch/mips/rtl838x/setup.c:64:30: error: comparison between two arrays [-Werror=array-compare]
>    64 |         else if (__dtb_start != __dtb_end)
> 
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> ---
> Kind of stupid....
> 
> But this is how similar fallout has been fixed in mainline AFAICS. For
> example commit ca831f29f8f2 ("mm: page_alloc: fix building error on
> -Werror=array-compare")

Externally linked data can be weird like that. Thanks for spotting this early, I'll be merging the
patch.

Best,
Sander
diff mbox series

Patch

diff --git a/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c b/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c
index 55419c7b0b7a..18c477eb0fe7 100644
--- a/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c
+++ b/target/linux/realtek/files-5.10/arch/mips/rtl838x/setup.c
@@ -61,7 +61,7 @@  void __init plat_mem_setup(void)
 
 	if (fw_passed_dtb) /* UHI interface */
 		dtb = (void *)fw_passed_dtb;
-	else if (__dtb_start != __dtb_end)
+	else if (&__dtb_start[0] != &__dtb_end[0])
 		dtb = (void *)__dtb_start;
 	else
 		panic("no dtb found");