[PATCH -next] firmware: imx: secure-enclave: use kzalloc_obj() for allocations

Pankaj Gupta posted 1 patch 3 weeks, 1 day ago
drivers/firmware/imx/se_ctrl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH -next] firmware: imx: secure-enclave: use kzalloc_obj() for allocations
Posted by Pankaj Gupta 3 weeks, 1 day ago
Replace kzalloc(sizeof(*ptr), ...) with kzalloc_obj() for object
allocations to follow current kernel allocation style and reduce
boilerplate.

No functional change intended.

This is a cleanup reported after initial merge and is intended to be
squashed into the original commit.

Fixes: 4de71839142b ("firmware: drivers: imx: adds miscdev")
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
---
 drivers/firmware/imx/se_ctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
index 814a1946d1c2..ef85a0336693 100644
--- a/drivers/firmware/imx/se_ctrl.c
+++ b/drivers/firmware/imx/se_ctrl.c
@@ -379,7 +379,7 @@ static int add_b_desc_to_pending_list(void *shared_ptr_with_pos,
 	struct se_shared_mem_mgmt_info *se_shared_mem_mgmt = &dev_ctx->se_shared_mem_mgmt;
 	struct se_buf_desc *b_desc;
 
-	b_desc = kzalloc(sizeof(*b_desc), GFP_KERNEL);
+	b_desc = kzalloc_obj(*b_desc, GFP_KERNEL);
 	if (!b_desc)
 		return -ENOMEM;
 
@@ -464,7 +464,7 @@ static int init_device_context(struct se_if_priv *priv, int ch_id,
 	struct se_if_device_ctx *dev_ctx;
 	int ret = 0;
 
-	dev_ctx = kzalloc(sizeof(*dev_ctx), GFP_KERNEL);
+	dev_ctx = kzalloc_obj(*dev_ctx, GFP_KERNEL);
 
 	if (!dev_ctx)
 		return -ENOMEM;
-- 
2.43.0
Re: [PATCH -next] firmware: imx: secure-enclave: use kzalloc_obj() for allocations
Posted by Frank Li 3 weeks ago
On Fri, 08 May 2026 11:30:20 +0530, Pankaj Gupta wrote:
> Replace kzalloc(sizeof(*ptr), ...) with kzalloc_obj() for object
> allocations to follow current kernel allocation style and reduce
> boilerplate.
>
> No functional change intended.
>
> This is a cleanup reported after initial merge and is intended to be
> squashed into the original commit.
>
> [...]

Applied, thanks!

[1/1] firmware: imx: secure-enclave: use kzalloc_obj() for allocations
squashed

Best regards,
--
Frank Li <Frank.Li@nxp.com>