Re: [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helpery
From: Pranjal Shrivastava
Date: Mon Jun 16 2025 - 18:52:24 EST
On Fri, Jun 13, 2025 at 11:35:25PM -0700, Nicolin Chen wrote:
> An object allocator needs to call either iommufd_object_finalize() upon a
> success or iommufd_object_abort_and_destroy() upon an error code.
>
> To reduce duplication, store a new_obj in the struct iommufd_ucmd and call
> iommufd_object_finalize/iommufd_object_abort_and_destroy() accordingly in
> the main function.
>
> Similar to iommufd_object_alloc() and __iommufd_object_alloc(), add a pair
> of helpers: __iommufd_object_alloc_ucmd() and iommufd_object_alloc_ucmd().
>
> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
> ---
> drivers/iommu/iommufd/iommufd_private.h | 26 +++++++++++++++++++++++++
> drivers/iommu/iommufd/main.c | 25 ++++++++++++++++++++++++
> 2 files changed, 51 insertions(+)
>
> --
Acked-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
> 2.43.0
>