[PATCH] ARM: make arrays containing machine compatible strings const

Arnd Bergmann arnd at arndb.de
Wed Feb 18 12:38:19 PST 2015


On Wednesday 18 February 2015 21:01:45 Uwe Kleine-König wrote:
> The definition
> 
>         static const char *axxia_dt_match[] __initconst = {
>                 ...
> 
> defines a changable array of constant strings. That is you must not do:
> 
>         *axxia_dt_match[0] = 'k';
> 
> but
> 
>         axxia_dt_match[0] = "different string";
> 
> is fine. So the annotation __initconst is wrong and yields a compiler
> error when other really const variables are added with __initconst.
> 
> As the struct machine_desc member dt_compat is declared as
> 
>         const char *const *dt_compat;
> 
> making the arrays const is the better alternative over changing all
> annotations to __initdata.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> 


Applied to fixes branch, thanks!

	Arnd



More information about the linux-arm-kernel mailing list