Skip to contentSkip to conversation

target-arm: Fix unreachable code in gicv3_class_name()

PATCH In review Peter Maydell 2 participants 2 messages Jul 11, 2016 – Jul 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-arm: Fix unreachable code in gicv3_class_name()

Coverity complains that the exit() in gicv3_class_name() can be unreachable, because if TARGET_AARCH64 is defined then all code paths return before reaching it. Move the exit() up to the error_report() that it belongs with.

---
 target-arm/machine.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
target-arm/machine.c +1 -2
index 2dbeb82..7a6ca31 100644
@@ -340,10 +340,9 @@ const char *gicv3_class_name(void)
 #else
         error_report("KVM GICv3 acceleration is not supported on this "
                      "platform");
+        exit(1);
 #endif
     } else {
         return "arm-gicv3";
     }
-
-    exit(1);
 }
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Peter Maydell

Coverity complains that the exit() in gicv3_class_name() can be unreachable, because if TARGET_AARCH64 is defined then all code paths return before reaching it. Move the exit() up to the error_report() that it belongs with.

Quoted 21 lines
---
 target-arm/machine.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
target-arm/machine.c +1 -2
index 2dbeb82..7a6ca31 100644
@@ -340,10 +340,9 @@ const char *gicv3_class_name(void)
 #else
         error_report("KVM GICv3 acceleration is not supported on this "
                      "platform");
+        exit(1);
 #endif
     } else {
         return "arm-gicv3";
     }
-
-    exit(1);
 }
Signature · 1 line
Shannon