Re: [PATCH 02/10] accel/amdxdna: Support hardware mailbox

From: Markus Elfring
Date: Sat Jul 20 2024 - 04:06:21 EST



> +++ b/drivers/accel/amdxdna/amdxdna_mailbox.c
> @@ -0,0 +1,582 @@

> +int xdna_mailbox_send_msg(struct mailbox_channel *mb_chann,
> + const struct xdna_mailbox_msg *msg, u64 tx_timeout)
> +{
> + struct xdna_msg_header *header;
> + struct mailbox_msg *mb_msg;

I propose to take another software design option better into account
also according to the application of scope-based resource management.

* You may reduce the scopes of such local variables.

* Would you like to use the attribute “__free(kfree)” accordingly?
https://elixir.bootlin.com/linux/v6.10/source/include/linux/slab.h#L282


> + mb_msg = kzalloc(sizeof(*mb_msg) + pkg_size, GFP_KERNEL);



Regards,
Markus