[PATCH v2 0/6] KVM: SEV: use mutex guards for simpler error handling

Carlos López posted 6 patches 2 weeks, 3 days ago
arch/x86/kvm/svm/sev.c | 134 ++++++++++++++---------------------------
1 file changed, 46 insertions(+), 88 deletions(-)
[PATCH v2 0/6] KVM: SEV: use mutex guards for simpler error handling
Posted by Carlos López 2 weeks, 3 days ago
Replace several uses of mutex_lock() / mutex_unlock() pairs with mutex
guards, which are less error-prone and help simplify error paths,
allowing removal of all gotos in some functions. This removes around 40
lines of code in total.

This does not remove all uses of the manual lock APIs, only those that
have their error handling improved by switching to the newer API.

Changes are separated per-function for ease of review.

---
v2: Removed an unnecessary include.

Carlos López (6):
  KVM: SEV: use mutex guard in snp_launch_update()
  KVM: SEV: use mutex guard in sev_mem_enc_ioctl()
  KVM: SEV: use mutex guard in sev_mem_enc_register_region()
  KVM: SEV: use mutex guard in sev_mem_enc_unregister_region()
  KVM: SEV: use mutex guard in snp_handle_guest_req()
  KVM: SEV: use scoped mutex guard in sev_asid_new()

 arch/x86/kvm/svm/sev.c | 134 ++++++++++++++---------------------------
 1 file changed, 46 insertions(+), 88 deletions(-)


base-commit: 0499add8efd72456514c6218c062911ccc922a99
-- 
2.51.0