diff mbox series

[v2,2/2] i386/sev: Nitpick at the error message's output

Message ID af66b40fe05eae1b641df92e73605e84412f926d.1704626686.git.yong.huang@smartx.com (mailing list archive)
State New, archived
Headers show
Series Nitpick at the error message's output | expand

Commit Message

Yong Huang Jan. 7, 2024, 11:53 a.m. UTC
The incorrect error message was produced as a result of
the return number being disregarded on the sev_kvm_init
failure path.

For instance, when a user's failure to launch a SEV guest
is caused by an incorrect IOCTL, the following message is
reported:

kvm: sev_kvm_init: failed to initialize ret=-25 fw_error=0
kvm: failed to initialize kvm: Operation not permitted

While the error message's accurate output should be:

kvm: sev_kvm_init: failed to initialize ret=-25 fw_error=0
kvm: failed to initialize kvm: Inappropriate ioctl for device

Fix this by returning the return number directly on the
failure path.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <c5033954155dfe256f650fc9ca2084c688356317.1704469721.git.yong.huang@smartx.com>
---
 target/i386/sev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/target/i386/sev.c b/target/i386/sev.c
index 96eff73001..3fef8cf163 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -1023,7 +1023,7 @@  int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
 err:
     sev_guest = NULL;
     ram_block_discard_disable(false);
-    return -1;
+    return ret;
 }
 
 int