diff mbox series

[1/3] arm64: constify icache_policy_str[]

Message ID 20190813141639.13476-2-mark.rutland@arm.com (mailing list archive)
State Mainlined
Commit 0bf136a8cf11502643c27c8de1b1db8f161a31ed
Headers show
Series arm64: trivial constification patches | expand

Commit Message

Mark Rutland Aug. 13, 2019, 2:16 p.m. UTC
The icache_policy_str[] array contains compile-time constant data, and
is never intentionally modified, so let's mark it as const.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/kernel/cpuinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dave Martin Aug. 14, 2019, 9:07 a.m. UTC | #1
On Tue, Aug 13, 2019 at 03:16:37PM +0100, Mark Rutland wrote:
> The icache_policy_str[] array contains compile-time constant data, and
> is never intentionally modified, so let's mark it as const.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/kernel/cpuinfo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 876055e37352..05933c065732 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -33,7 +33,7 @@
>  DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
>  static struct cpuinfo_arm64 boot_cpu_data;
>  
> -static char *icache_policy_str[] = {
> +static const char *icache_policy_str[] = {

Can this be const char *const ?

The strings will be in .rodata and can't be modified anyway, but I
presume we don't modify the array elements either...

>  	[0 ... ICACHE_POLICY_PIPT]	= "RESERVED/UNKNOWN",
>  	[ICACHE_POLICY_VIPT]		= "VIPT",
>  	[ICACHE_POLICY_PIPT]		= "PIPT",

[...]

Cheers
---Dave
diff mbox series

Patch

diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 876055e37352..05933c065732 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -33,7 +33,7 @@ 
 DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
 static struct cpuinfo_arm64 boot_cpu_data;
 
-static char *icache_policy_str[] = {
+static const char *icache_policy_str[] = {
 	[0 ... ICACHE_POLICY_PIPT]	= "RESERVED/UNKNOWN",
 	[ICACHE_POLICY_VIPT]		= "VIPT",
 	[ICACHE_POLICY_PIPT]		= "PIPT",