[03/19] powerpc: Mark variables as unused

Message ID 20180322202007.23088-4-malat@debian.org
State Not Applicable
Headers show
Series
  • powerpc/ppc32: make W=1 compilation errors free
Related show

Commit Message

Mathieu Malaterre March 22, 2018, 8:19 p.m.
Add gcc attribute unused for two variables. Fix warnings treated as errors
with W=1:

  arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/kernel/prom_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christophe Leroy March 23, 2018, 10:03 a.m. | #1
Le 22/03/2018 à 21:19, Mathieu Malaterre a écrit :
> Add gcc attribute unused for two variables. Fix warnings treated as errors
> with W=1:
> 
>    arch/powerpc/kernel/prom_init.c:1388:8: error: variable ‘path’ set but not used [-Werror=unused-but-set-variable]
> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
>   arch/powerpc/kernel/prom_init.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index acf4b2e0530c..6a3ac4522144 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -603,7 +603,7 @@ static void __init early_cmdline_parse(void)
>   	const char *opt;
>   
>   	char *p;
> -	int l = 0;
> +	int l __maybe_unused = 0;
>   
>   	prom_cmd_line[0] = 0;
>   	p = prom_cmd_line;
> @@ -1385,7 +1385,7 @@ static void __init reserve_mem(u64 base, u64 size)
>   static void __init prom_init_mem(void)
>   {
>   	phandle node;
> -	char *path, type[64];
> +	char *path __maybe_unused, type[64];

path is only used if DEBUG_PROM is defined, so it should be enclosed 
into #ifdef DEBUG_PROM

Christophe

>   	unsigned int plen;
>   	cell_t *p, *endp;
>   	__be32 val;
> 

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index acf4b2e0530c..6a3ac4522144 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -603,7 +603,7 @@  static void __init early_cmdline_parse(void)
 	const char *opt;
 
 	char *p;
-	int l = 0;
+	int l __maybe_unused = 0;
 
 	prom_cmd_line[0] = 0;
 	p = prom_cmd_line;
@@ -1385,7 +1385,7 @@  static void __init reserve_mem(u64 base, u64 size)
 static void __init prom_init_mem(void)
 {
 	phandle node;
-	char *path, type[64];
+	char *path __maybe_unused, type[64];
 	unsigned int plen;
 	cell_t *p, *endp;
 	__be32 val;