All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] KVM: Adjust the return type of kvm_vm_ioctl_check_extension_generic()
Date: Tue, 31 May 2022 09:55:40 +0200	[thread overview]
Message-ID: <20220531075540.14242-1-thuth@redhat.com> (raw)

kvm_vm_ioctl_check_extension_generic() either returns small constant
numbers or the result of kvm_vm_ioctl_check_extension() which is of type
"int". Looking at the callers of kvm_vm_ioctl_check_extension_generic(),
one stores the result in "int r", the other one in "long r", so the
result has to fit in the smaller "int" in any case. Thus let's adjust
the return value to "int" here so we have one less transition from
"int" -> "long" -> "int" in case of the kvm_vm_ioctl() ->
kvm_vm_ioctl_check_extension_generic() -> kvm_vm_ioctl_check_extension()
call chain.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 This patch is of very low importance - if you don't like it, please just
 ignore. I just came across this nit while looking through the code and
 thought that it might be somewhat nicer this way.

 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 64ec2222a196..e911331fc620 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4309,7 +4309,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
 	return 0;
 }
 
-static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
+static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
 {
 	switch (arg) {
 	case KVM_CAP_USER_MEMORY:
-- 
2.31.1


             reply	other threads:[~2022-05-31  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31  7:55 Thomas Huth [this message]
2022-05-31 19:39 ` [PATCH] KVM: Adjust the return type of kvm_vm_ioctl_check_extension_generic() Sean Christopherson
2022-06-01 10:48   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220531075540.14242-1-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.