diff options
author | Yi Liu <yi.l.liu@intel.com> | 2023-07-18 16:55:44 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2023-07-25 19:19:45 +0300 |
commit | 5c6de3ea73768d1781024e4a41f77d6d71bc64cb (patch) | |
tree | c4ce32ecd51c449bce1579818ede6b620b295e16 /drivers/vfio/group.c | |
parent | 8b6f173a4ce47ef0606124710315560c64f2344e (diff) | |
download | linux-5c6de3ea73768d1781024e4a41f77d6d71bc64cb.tar.xz |
vfio: Test kvm pointer in _vfio_device_get_kvm_safe()
This saves some lines when adding the kvm get logic for the vfio_device
cdev path.
This also renames _vfio_device_get_kvm_safe() to be vfio_device_get_kvm_safe().
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Tested-by: Yanting Jiang <yanting.jiang@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20230718135551.6592-20-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/group.c')
-rw-r--r-- | drivers/vfio/group.c | 7 |
1 files changed, 1 insertions, 6 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); } |