fix: uninitialized value warning in handler.c
Initialize vcpu to null during declaration to silence the uninitialized
value warning thrown by clang tidy.
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I3e5eaacb143015acb26c3829dfa9502b4727e39e
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 19b0f05..572c8b8 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -360,7 +360,6 @@
uint32_t psci_msg_response = PSCI_ERROR_NOT_SUPPORTED;
struct vcpu *boot_vcpu = vcpu_get_boot_vcpu();
struct vm *vm = boot_vcpu->vm;
- struct vcpu *vcpu;
struct vcpu_locked vcpu_locked;
/*
@@ -370,10 +369,9 @@
*/
switch (args->arg3) {
case PSCI_CPU_OFF: {
- dlog_verbose("cpu%u off notification!\n",
- vcpu_index(vcpu));
-
if (vm_power_management_cpu_off_requested(vm) == true) {
+ struct vcpu *vcpu;
+
/* Allow only S-EL1 MP SPs to reach here. */
CHECK(vm->el0_partition == false);
CHECK(vm->vcpu_count > 1);
@@ -383,6 +381,8 @@
vcpu->state = VCPU_STATE_OFF;
vcpu_unlock(&vcpu_locked);
cpu_off(vcpu->cpu);
+ dlog_verbose("cpu%u off notification!\n",
+ vcpu_index(vcpu));
}
psci_msg_response = PSCI_RETURN_SUCCESS;