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>
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);