[PATCH 1/2] kexec: Fix compiler ambiguous else warning

Geoff Levand geoff at infradead.org
Tue Feb 17 17:00:07 PST 2015


Add braces to if statments in fs2dt.c.  Fixes warnings like these when compiling
with gcc 4.9.1:

  kexec/fs2dt.c: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]

Signed-off-by: Geoff Levand <geoff at infradead.org>
---
 kexec/fs2dt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c
index 3b4432d..fa7b550 100644
--- a/kexec/fs2dt.c
+++ b/kexec/fs2dt.c
@@ -122,16 +122,17 @@ static void checkprop(char *name, unsigned *data, int len)
 	else if (!strcmp(name, "rtas-size") ||
 			!strcmp(name, "linux,tce-size"))
 		size = be32_to_cpu(*data);
-	else if (reuse_initrd && !strcmp(name, "linux,initrd-start"))
+	else if (reuse_initrd && !strcmp(name, "linux,initrd-start")) {
 		if (len == 8)
 			base = be64_to_cpu(*(unsigned long long *) data);
 		else
 			base = be32_to_cpu(*data);
-	else if (reuse_initrd && !strcmp(name, "linux,initrd-end"))
+	} else if (reuse_initrd && !strcmp(name, "linux,initrd-end")) {
 		if (len == 8)
 			end = be64_to_cpu(*(unsigned long long *) data);
 		else
 			end = be32_to_cpu(*data);
+	}
 
 	if (size && end)
 		die("unrecoverable error: size and end set at same time\n");
-- 
2.1.0





More information about the kexec mailing list