KVM: PPC: Book3S: Remove useless checks in 'release' method of KVM device
authorCédric Le Goater <clg@kaod.org>
Thu, 9 May 2019 12:33:44 +0000 (14:33 +0200)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 14 May 2019 02:06:03 +0000 (12:06 +1000)
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>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
virt/kvm/kvm_main.c

index ea2619d5ca984f1a7ab6f7733387b923fcc320e1..37149433c07ade6c89a71b2de4ad2fce599a5b70 100644 (file)
@@ -2938,12 +2938,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);