Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH v2] KVM: PPC: Book3S HV: Clean up on uvmem initialization failure
@ 2026-11-18 10:20 Haoxiang Li
  2026-11-18 11:14 ` Ritesh Harjani
  2026-11-18 18:47 ` Fabiano Rosas
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2026-11-18 10:20 UTC (permalink / raw)
  To: maddy, npiggin, mpe, chleroy, ritesh.list, sshegde, farosas
  Cc: linuxppc-dev, kvm, linux-kernel, 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")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
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(-)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 22283d46e8fe..620097f292b8 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] KVM: PPC: Book3S HV: Clean up on uvmem initialization failure
  2026-11-18 10:20 [PATCH v2] KVM: PPC: Book3S HV: Clean up on uvmem initialization failure Haoxiang Li
@ 2026-11-18 11:14 ` Ritesh Harjani
  2026-11-18 18:47 ` Fabiano Rosas
  1 sibling, 0 replies; 3+ messages in thread
From: Ritesh Harjani @ 2026-11-18 11:14 UTC (permalink / raw)
  To: Haoxiang Li, maddy, npiggin, mpe, chleroy, sshegde, farosas
  Cc: linuxppc-dev, kvm, linux-kernel, Haoxiang Li

Haoxiang Li <haoxiang_li2024@163.com> writes:

> 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")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>

LGTM. Feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] KVM: PPC: Book3S HV: Clean up on uvmem initialization failure
  2026-11-18 10:20 [PATCH v2] KVM: PPC: Book3S HV: Clean up on uvmem initialization failure Haoxiang Li
  2026-11-18 11:14 ` Ritesh Harjani
@ 2026-11-18 18:47 ` Fabiano Rosas
  1 sibling, 0 replies; 3+ messages in thread
From: Fabiano Rosas @ 2026-11-18 18:47 UTC (permalink / raw)
  To: Haoxiang Li, maddy, npiggin, mpe, chleroy, ritesh.list, sshegde,
	farosas
  Cc: linuxppc-dev, kvm, linux-kernel, Haoxiang Li

Haoxiang Li <haoxiang_li2024@163.com> writes:

> 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")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> 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(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 22283d46e8fe..620097f292b8 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -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)

Reviewed-by: Fabiano Rosas <farosas@suse.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-18 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 10:20 [PATCH v2] KVM: PPC: Book3S HV: Clean up on uvmem initialization failure Haoxiang Li
2026-11-18 11:14 ` Ritesh Harjani
2026-11-18 18:47 ` Fabiano Rosas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox