diff mbox series

[5/6] arm/platforms: Make compatbile with -Wwrite-strings

Message ID 20231120224912.1421916-6-andrew.cooper3@citrix.com (mailing list archive)
State Superseded
Headers show
Series xen: Enable -Wwrite-strings | expand

Commit Message

Andrew Cooper Nov. 20, 2023, 10:49 p.m. UTC
GCC complains:

  arch/arm/platforms/brcm.c: In function ‘brcm_populate_plat_regs’:
  arch/arm/platforms/brcm.c:76:27: error: passing argument 1 of ‘brcm_get_dt_node’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
     76 |     rc = brcm_get_dt_node("brcm,brcmstb-cpu-biu-ctrl", &node, &reg_base);
        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~

and

  arch/arm/platforms/exynos5.c: In function ‘exynos5_smp_init’:
  arch/arm/platforms/exynos5.c:109:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    109 |         compatible = "samsung,exynos4210-sysram-ns";
        |                    ^

In both cases, just make the relevant variable const.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Roberto Bagnara <roberto.bagnara@bugseng.com>
CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 xen/arch/arm/platforms/brcm.c    | 2 +-
 xen/arch/arm/platforms/exynos5.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini Nov. 21, 2023, 12:51 a.m. UTC | #1
On Mon, 20 Nov 2023, Andrew Cooper wrote:
> GCC complains:
> 
>   arch/arm/platforms/brcm.c: In function ‘brcm_populate_plat_regs’:
>   arch/arm/platforms/brcm.c:76:27: error: passing argument 1 of ‘brcm_get_dt_node’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>      76 |     rc = brcm_get_dt_node("brcm,brcmstb-cpu-biu-ctrl", &node, &reg_base);
>         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> and
> 
>   arch/arm/platforms/exynos5.c: In function ‘exynos5_smp_init’:
>   arch/arm/platforms/exynos5.c:109:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>     109 |         compatible = "samsung,exynos4210-sysram-ns";
>         |                    ^
> 
> In both cases, just make the relevant variable const.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
> CC: Bertrand Marquis <bertrand.marquis@arm.com>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Roberto Bagnara <roberto.bagnara@bugseng.com>
> CC: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
>  xen/arch/arm/platforms/brcm.c    | 2 +-
>  xen/arch/arm/platforms/exynos5.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/platforms/brcm.c b/xen/arch/arm/platforms/brcm.c
> index 951e4d6cc328..43a07ab1a69d 100644
> --- a/xen/arch/arm/platforms/brcm.c
> +++ b/xen/arch/arm/platforms/brcm.c
> @@ -35,7 +35,7 @@ static u32 brcm_boot_continuation_pc;
>  
>  static struct brcm_plat_regs regs;
>  
> -static __init int brcm_get_dt_node(char *compat_str,
> +static __init int brcm_get_dt_node(const char *compat_str,
>                                     const struct dt_device_node **dn,
>                                     u32 *reg_base)
>  {
> diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c
> index c48093cd4fa4..f7c09520675e 100644
> --- a/xen/arch/arm/platforms/exynos5.c
> +++ b/xen/arch/arm/platforms/exynos5.c
> @@ -96,7 +96,7 @@ static int __init exynos5_smp_init(void)
>  {
>      struct dt_device_node *node;
>      void __iomem *sysram;
> -    char *compatible;
> +    const char *compatible;
>      paddr_t sysram_addr;
>      paddr_t size;
>      paddr_t sysram_offset;
> -- 
> 2.30.2
> 
>
diff mbox series

Patch

diff --git a/xen/arch/arm/platforms/brcm.c b/xen/arch/arm/platforms/brcm.c
index 951e4d6cc328..43a07ab1a69d 100644
--- a/xen/arch/arm/platforms/brcm.c
+++ b/xen/arch/arm/platforms/brcm.c
@@ -35,7 +35,7 @@  static u32 brcm_boot_continuation_pc;
 
 static struct brcm_plat_regs regs;
 
-static __init int brcm_get_dt_node(char *compat_str,
+static __init int brcm_get_dt_node(const char *compat_str,
                                    const struct dt_device_node **dn,
                                    u32 *reg_base)
 {
diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c
index c48093cd4fa4..f7c09520675e 100644
--- a/xen/arch/arm/platforms/exynos5.c
+++ b/xen/arch/arm/platforms/exynos5.c
@@ -96,7 +96,7 @@  static int __init exynos5_smp_init(void)
 {
     struct dt_device_node *node;
     void __iomem *sysram;
-    char *compatible;
+    const char *compatible;
     paddr_t sysram_addr;
     paddr_t size;
     paddr_t sysram_offset;