Re: [PATCH 10/11] iommu: Split iommu_group_add_device()

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

 



On Thu, Apr 20, 2023 at 12:25:11PM +0800, Baolu Lu wrote:
> On 4/20/23 12:11 AM, Jason Gunthorpe wrote:
> > @@ -451,16 +454,17 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
> >   		goto out_unlock;
> >   	group = dev->iommu_group;
> > -	ret = iommu_group_add_device(group, dev);
> > +	gdev = iommu_group_alloc_device(group, dev);
> >   	mutex_lock(&group->mutex);
> > -	if (ret)
> > +	if (IS_ERR(gdev)) {
> > +		ret = PTR_ERR(gdev);
> >   		goto err_put_group;
> > +	}
> > +	list_add_tail(&gdev->list, &group->devices);
> 
> Do we need to put
> 
> 	dev->iommu_group = group;
> 
> here?

It is done in iommu_init_driver() and iommu_deinit_driver() NULL's it

	group = ops->device_group(dev);
	if (WARN_ON_ONCE(group == NULL))
		group = ERR_PTR(-EINVAL);
	if (IS_ERR(group)) {
		ret = PTR_ERR(group);
		goto err_unlink;
	}
	dev->iommu_group = group;

Jason



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux