Re: [PATCH 04/14] vfio: factor out a vfio_group_find_or_alloc helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 24, 2021 at 08:40:50PM -0300, Jason Gunthorpe wrote:
> I think the non-"success oriented flow" is less readable than what was
> before. It is jarring to see, and I was about to say this is not
> logically the same having missed the !...
> 
> How about:
> 
>         /* If found group already holds the iommu_group reference */
> 	group = vfio_group_get_from_iommu(iommu_group);
> 	if (group)
>             goto out_put;
> 
> 	group = vfio_create_group(iommu_group);
> 	if (IS_ERR(group))
> 	     goto out_put;
>         /* If created our iommu_group reference was moved to group, keep it */
> 	return group;
> 
> out_put:
> 	vfio_iommu_group_put(iommu_group, dev);
> 	return group;

Fine with me.  I actually repeatedly switched between the two flows
because I couldn't decide on one.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux