Re: [PATCH v2 03/19] powerpc: Mark variables as unused
From: LEROY Christophe <hidden>
Date: 2018-03-29 16:14:43
Also in:
lkml
Mathieu Malaterre [off-list ref] a =C3=A9crit=C2=A0:
Add gcc attribute unused for two variables. Fix warnings treated as error=
s
with W=3D1: arch/powerpc/kernel/prom_init.c:1388:8: error: variable =E2=80=98path=
=E2=80=99 set=20=20
quoted hunk ↗ jump to hunk
=20but not used [-Werror=3Dunused-but-set-variable] Suggested-by: Christophe Leroy <redacted> Signed-off-by: Mathieu Malaterre <redacted> --- v2: move path within ifdef DEBUG_PROM arch/powerpc/kernel/prom_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)diff --git a/arch/powerpc/kernel/prom_init.c=20=20=20b/arch/powerpc/kernel/prom_init.c index acf4b2e0530c..4163b11abb6c 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 =3D 0; + int l __maybe_unused =3D 0; prom_cmd_line[0] =3D 0; p =3D 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];
You should enclose that in an ifdef DEBUG_PROM instead of hiding the warnin= g Christophe
quoted hunk ↗ jump to hunk
unsigned int plen; cell_t *p, *endp; __be32 val;@@ -1406,7 +1406,6 @@ static void __init prom_init_mem(void) prom_debug("root_size_cells: %x\n", rsc); prom_debug("scanning memory:\n"); - path =3D prom_scratch; for (node =3D 0; prom_next_node(&node); ) { type[0] =3D 0;@@ -1431,6 +1430,7 @@ static void __init prom_init_mem(void) endp =3D p + (plen / sizeof(cell_t)); #ifdef DEBUG_PROM + path =3D prom_scratch; memset(path, 0, PROM_SCRATCH_SIZE); call_prom("package-to-path", 3, 1, node, path, PROM_SCRATCH_SIZE-1); prom_debug(" node %s :\n", path); --2.11.0