diff mbox series

[v2] KVM: Remove useless checks in 'release' method of KVM device

Message ID 20190509123344.3031-1-clg@kaod.org (mailing list archive)
State New, archived
Headers show
Series [v2] KVM: Remove useless checks in 'release' method of KVM device | expand

Commit Message

Cédric Le Goater May 9, 2019, 12:33 p.m. UTC
There is no need to test for the device pointer validity when releasing
a KVM device. The file descriptor should identify it safely.

Fixes: 2bde9b3ec8bd ("KVM: Introduce a 'release' method for KVM devices")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

 Changes since v1:

 - better commit log title.
 
 virt/kvm/kvm_main.c | 6 ------
 1 file changed, 6 deletions(-)
diff mbox series

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 161830ec0aa5..ac15b8fd8399 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2939,12 +2939,6 @@  static int kvm_device_release(struct inode *inode, struct file *filp)
 	struct kvm_device *dev = filp->private_data;
 	struct kvm *kvm = dev->kvm;
 
-	if (!dev)
-		return -ENODEV;
-
-	if (dev->kvm != kvm)
-		return -EPERM;
-
 	if (dev->ops->release) {
 		mutex_lock(&kvm->lock);
 		list_del(&dev->vm_node);