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.