diff options
| author | Sean Christopherson <seanjc@google.com> | 2026-03-11 02:48:29 +0300 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-04-09 22:00:24 +0300 |
| commit | bc0932cf9b9917e826871db947398aa2b62789b2 (patch) | |
| tree | 910e3909ee76a33bcc909d63f5b0523ef8ef072a /arch | |
| parent | 1d353dae3d33bf22fba47a96b627eeb7bfe37be8 (diff) | |
| download | linux-bc0932cf9b9917e826871db947398aa2b62789b2.tar.xz | |
KVM: SEV: Goto an existing error label if charging misc_cg for an ASID fails
Dedup a small amount of cleanup code in SEV ASID allocation by reusing
an existing error label.
No functional change intended.
Link: https://patch.msgid.link/20260310234829.2608037-22-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/kvm/svm/sev.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 1567d01ef464..734e5206fbf9 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -289,14 +289,11 @@ static int sev_asid_new(struct kvm_sev_info *sev, unsigned long vm_type) if (min_asid > max_asid) return -ENOTTY; - WARN_ON(sev->misc_cg); + WARN_ON_ONCE(sev->misc_cg); sev->misc_cg = get_current_misc_cg(); ret = sev_misc_cg_try_charge(sev); - if (ret) { - put_misc_cg(sev->misc_cg); - sev->misc_cg = NULL; - return ret; - } + if (ret) + goto e_put_cg; asid = sev_alloc_asid(min_asid, max_asid); if (asid > max_asid) { @@ -306,8 +303,10 @@ static int sev_asid_new(struct kvm_sev_info *sev, unsigned long vm_type) sev->asid = asid; return 0; + e_uncharge: sev_misc_cg_uncharge(sev); +e_put_cg: put_misc_cg(sev->misc_cg); sev->misc_cg = NULL; return ret; |
