[PATCH v3 05/10] lib: add dmabuf token infrastructure

Markus Elfring Markus.Elfring at web.de
Mon May 18 04:24:24 PDT 2026


…
> +++ b/lib/io_dmabuf_token.c
> @@ -0,0 +1,272 @@
…
> +int io_dmabuf_init_map(struct io_dmabuf_token *token, struct io_dmabuf_map *map)
> +{
> +	struct io_dmabuf_fence *fence = NULL;
> +	int ret;
> +
> +	fence = kzalloc(sizeof(*fence), GFP_KERNEL);

How do you think about to use kzalloc_obj() instead?
https://elixir.bootlin.com/linux/v7.1-rc3/source/include/linux/slab.h#L1039-L1040


…
> +	if (!fence)
> +		return -ENOMEM;
> +
> +	ret = percpu_ref_init(&map->refs, io_dmabuf_map_refs_release, 0, GFP_KERNEL);
> +	if (ret) {
> +		kfree(fence);
> +		return ret;
> +	}
…

Would you like to use the attribute “__free(kfree)”?
https://elixir.bootlin.com/linux/v7.1-rc3/source/include/linux/slab.h#L517

Regards,
Markus



More information about the Linux-nvme mailing list