[PATCH 5.11 435/601] KVM: arm64: Fix error return code in init_hyp_mode()

Greg Kroah-Hartman
2021-05-12T17:56:04Z

From: Wang Wensheng <wangwensheng4@huawei.com>

[ Upstream commit 52b9e265d22bccc5843e167da76ab119874e2883 ]

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: eeeee7193df0 ("KVM: arm64: Bootstrap PSCI SMC handler in nVHE EL2")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210406121759.5407-1-wangwensheng4@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kvm/arm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index b25b4c19feeb..64258d26ba24 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -1809,8 +1809,10 @@ static int init_hyp_mode(void)
if (is_protected_kvm_enabled()) {
init_cpu_logical_map();

- if (!init_psci_relay())
+ if (!init_psci_relay()) {
+ err = -ENODEV;
goto out_err;
+ }
}

return 0;
--
2.30.2