]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
MIPS: Octeon: Fix build errors using clang
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Thu, 16 Dec 2021 09:50:14 +0000 (17:50 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:36:37 +0000 (16:36 +0100)
BugLink: https://bugs.launchpad.net/bugs/1960566
[ Upstream commit 95339b70677dc6f9a2d669c4716058e71b8dc1c7 ]

A large number of the following errors is reported when compiling
with clang:

  cvmx-bootinfo.h:326:3: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
                  ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL)
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE'
          case x: return(#x + 16);        /* Skip CVMX_BOARD_TYPE_ */
                         ~~~^~~~
  cvmx-bootinfo.h:326:3: note: use array indexing to silence this warning
  cvmx-bootinfo.h:321:20: note: expanded from macro 'ENUM_BRD_TYPE_CASE'
          case x: return(#x + 16);        /* Skip CVMX_BOARD_TYPE_ */
                          ^

Follow the prompts to use the address operator '&' to fix this error.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/mips/include/asm/octeon/cvmx-bootinfo.h

index 62787765575efff0baee2c0b67f1c6fb4afcb51e..ce6e5fddce0bf9a0270fd2c0ec97f26923a246c9 100644 (file)
@@ -315,7 +315,7 @@ enum cvmx_chip_types_enum {
 
 /* Functions to return string based on type */
 #define ENUM_BRD_TYPE_CASE(x) \
-       case x: return(#x + 16);        /* Skip CVMX_BOARD_TYPE_ */
+       case x: return (&#x[16]);       /* Skip CVMX_BOARD_TYPE_ */
 static inline const char *cvmx_board_type_to_string(enum
                                                    cvmx_board_types_enum type)
 {
@@ -404,7 +404,7 @@ static inline const char *cvmx_board_type_to_string(enum
 }
 
 #define ENUM_CHIP_TYPE_CASE(x) \
-       case x: return(#x + 15);        /* Skip CVMX_CHIP_TYPE */
+       case x: return (&#x[15]);       /* Skip CVMX_CHIP_TYPE */
 static inline const char *cvmx_chip_type_to_string(enum
                                                   cvmx_chip_types_enum type)
 {