[PATCH v5 04/13] iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl
Nicolin Chen
nicolinc at nvidia.com
Tue Oct 29 09:03:49 PDT 2024
On Tue, Oct 29, 2024 at 12:59:35PM -0300, Jason Gunthorpe wrote:
> On Tue, Oct 29, 2024 at 08:46:40AM -0700, Nicolin Chen wrote:
> > On Tue, Oct 29, 2024 at 12:36:24PM -0300, Jason Gunthorpe wrote:
> > > On Tue, Oct 29, 2024 at 11:54:36AM -0300, Jason Gunthorpe wrote:
> > > > On Fri, Oct 25, 2024 at 04:49:44PM -0700, Nicolin Chen wrote:
> > > > > +void iommufd_viommu_destroy(struct iommufd_object *obj)
> > > > > +{
> > > > > + struct iommufd_viommu *viommu =
> > > > > + container_of(obj, struct iommufd_viommu, obj);
> > > > > +
> > > > > + if (viommu->ops && viommu->ops->free)
> > > > > + viommu->ops->free(viommu);
> > > >
> > > > Ops can't be null and free can't be null, that would mean there is a
> > > > memory leak.
> > >
> > > Actually, it is just named wrong, it should be called destroy like
> > > this op, it doesn't free any memory..
> >
> > Well, it frees if driver allocated something in its top structure.
> > Yet, "destroy" does sound less confusing. Let's rename it, assuming
> > it can still remain to be optional as we have here.
>
> Yes, optional is right, I was confused by the name. The core code uses
> destroy so I'd stick with that.
Ack.
Nicolin
More information about the linux-arm-kernel
mailing list