diff options
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/group.c | 7 | ||||
-rw-r--r-- | drivers/vfio/vfio.h | 6 | ||||
-rw-r--r-- | drivers/vfio/vfio_main.c | 5 |
3 files changed, 8 insertions, 10 deletions
diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c index 41a09a2df690..5c17ad812313 100644 --- a/drivers/vfio/group.c +++ b/drivers/vfio/group.c @@ -160,12 +160,7 @@ out_unlock: static void vfio_device_group_get_kvm_safe(struct vfio_device *device) { spin_lock(&device->group->kvm_ref_lock); - if (!device->group->kvm) - goto unlock; - - _vfio_device_get_kvm_safe(device, device->group->kvm); - -unlock: + vfio_device_get_kvm_safe(device, device->group->kvm); spin_unlock(&device->group->kvm_ref_lock); } diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h index fb8f2fac3d23..c2aa65382592 100644 --- a/drivers/vfio/vfio.h +++ b/drivers/vfio/vfio.h @@ -340,11 +340,11 @@ enum { vfio_noiommu = false }; #endif #ifdef CONFIG_HAVE_KVM -void _vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm); +void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm); void vfio_device_put_kvm(struct vfio_device *device); #else -static inline void _vfio_device_get_kvm_safe(struct vfio_device *device, - struct kvm *kvm) +static inline void vfio_device_get_kvm_safe(struct vfio_device *device, + struct kvm *kvm) { } diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 8a9ebcc6980b..5f7c3151d8c0 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -373,7 +373,7 @@ void vfio_unregister_group_dev(struct vfio_device *device) EXPORT_SYMBOL_GPL(vfio_unregister_group_dev); #ifdef CONFIG_HAVE_KVM -void _vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm) +void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm) { void (*pfn)(struct kvm *kvm); bool (*fn)(struct kvm *kvm); @@ -381,6 +381,9 @@ void _vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm) lockdep_assert_held(&device->dev_set->lock); + if (!kvm) + return; + pfn = symbol_get(kvm_put_kvm); if (WARN_ON(!pfn)) return; |