From: Yash Suthar <yashsuthar983@gmail.com>
To: pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: skhan@linuxfoundation.org, me@brighamcampbell.com,
yashsuthar983@gmail.com
Subject: [PATCH v2] KVM: vfio: Convert fget() to CLASS(fd) in kvm_vfio_file_add()
Date: Mon, 15 Jun 2026 22:59:50 +0530 [thread overview]
Message-ID: <20260615172950.107275-1-yashsuthar983@gmail.com> (raw)
In-Reply-To: <20260523050242.41472-1-yashsuthar983@gmail.com>
Convert fget() with __free(fput) cleanup to CLASS(fd, f),
using fd_empty() and fd_file().
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
---
virt/kvm/vfio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index 6cdc4e9a333a..bbd7a5dfb76e 100644
--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -144,12 +144,14 @@ static int kvm_vfio_file_add(struct kvm_device *dev, unsigned int fd)
{
struct kvm_vfio *kv = dev->private;
struct kvm_vfio_file *kvf;
- struct file *filp __free(fput) = NULL;
+ CLASS(fd, f)(fd);
+ struct file *filp = NULL;
- filp = fget(fd);
- if (!filp)
+ if (fd_empty(f))
return -EBADF;
+ filp = fd_file(f);
+
/* Ensure the FD is a vfio FD. */
if (!kvm_vfio_file_is_valid(filp))
return -EINVAL;
--
2.43.0
prev parent reply other threads:[~2026-06-15 12:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 5:02 [PATCH] kvm: vfio: Convert kvm_vfio_file_add() to use CLASS(fd) and guard(mutex) Yash Suthar
2026-06-12 16:15 ` Alex Williamson
2026-06-12 16:17 ` Alex Williamson
2026-06-15 17:29 ` Yash Suthar [this message]
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=20260615172950.107275-1-yashsuthar983@gmail.com \
--to=yashsuthar983@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@brighamcampbell.com \
--cc=pbonzini@redhat.com \
--cc=skhan@linuxfoundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®