Skip to contentSkip to conversation

KVM: PPC: Book3S HV: Clean up on uvmem initialization failure

PATCH Applied Haoxiang Li 4 participants 4 messages Nov 18 – Nov 22

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 KVM: PPC: Book3S HV: Clean up on uvmem initialization failure

When kvmppc_uvmem_init() fails, kvmppc_book3s_init_hv() returns directly, bypassing the existing error path. Jump to the existing error path to clean up before returning the error.

Fixes 175be7e5800e ("KVM: PPC: Book3S HV: Free allocated memory if module init fails")

---
Changes in v2:
- Change the Fixes tag.
- Modify the patch title.

---
 arch/powerpc/kvm/book3s_hv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv.c +1 -1
index 22283d46e8fe..620097f292b8 100644
@@ -6743,7 +6743,7 @@ static int kvmppc_book3s_init_hv(void)
 	r = kvmppc_uvmem_init();
 	if (r < 0) {
 		pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r);
-		return r;
+		goto err;
 	}
 
 #if defined(CONFIG_KVM_XICS)
Signature · 1 line
2.25.1
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Haoxiang Li

When kvmppc_uvmem_init() fails, kvmppc_book3s_init_hv() returns directly, bypassing the existing error path. Jump to the existing error path to clean up before returning the error.

Fixes 175be7e5800e ("KVM: PPC: Book3S HV: Free allocated memory if module init fails")

LGTM. Feel free to add:

Reviewed-by on v2 1/1
#2 lore raw
In reply to Haoxiang Li
Quoted 19 lines · Haoxiang Li

When kvmppc_uvmem_init() fails, kvmppc_book3s_init_hv() returns directly, bypassing the existing error path. Jump to the existing error path to clean up before returning the error.

Fixes 175be7e5800e ("KVM: PPC: Book3S HV: Free allocated memory if module init fails")

---
Changes in v2:
- Change the Fixes tag.
- Modify the patch title.

---
 arch/powerpc/kvm/book3s_hv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv.c +0 -0
index 22283d46e8fe..620097f292b8 100644

arch/powerpc/kvm/book3s_hv.c static int kvmppc_book3s_init_hv(void) · line 6749

Quoted 8 lines
arch/powerpc/kvm/book3s_hv.c +1 -1
@@ -6743,7 +6743,7 @@ static int kvmppc_book3s_init_hv(void)
 	r = kvmppc_uvmem_init();
 	if (r < 0) {
 		pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r);
-		return r;
+		goto err;
 	}
 
 #if defined(CONFIG_KVM_XICS)