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

Markus Elfring <[email protected]>
Newsgroups org.kernel.vger.io-uring,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-nvme,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media
Message-ID <[email protected]>
…
> +++ 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.