Re: [PATCH net-next] octeontx2-af: CGX: use kzalloc_flex for name
From: Joe Damato
Date: Fri Mar 13 2026 - 16:33:54 EST
On Thu, Mar 12, 2026 at 05:32:40PM -0700, Rosen Penev wrote:
> Don't bother allocating separately. There's no good reason to do so for
> a small string like this.
>
> Remove name kfrees as a result.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 13 +++----------
> .../net/ethernet/marvell/octeontx2/af/lmac_common.h | 2 +-
> 2 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> index 4f33a816bc7a..0750fb696c90 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
> @@ -1725,14 +1725,10 @@ static int cgx_lmac_init(struct cgx *cgx)
> cgx->lmac_count = cgx->max_lmac_per_mac;
>
> for (i = 0; i < cgx->lmac_count; i++) {
> - lmac = kzalloc_obj(struct lmac);
> + lmac = kzalloc_flex(struct lmac, name, sizeof("cgx_fwi_xxx_yyy"));
Seems fine overall, I guess a minor nit is that I thought the typical style of
kzalloc_flex usage would be kzalloc_flex(*lmac, ....
idk if it's really worth a respin just for that, so:
Reviewed-by: Joe Damato <joe@xxxxxxx>