Re: [PATCH linux-next] leds: netxbig: drop the second allocation of the leds array
From: Lee Jones
Date: Wed Dec 02 2026 - 04:25:12 EST
FAO Mark,
> Since next-20261120 the merge of the leds-lj tree with the origin tree
> allocates the leds array in netxbig_leds_get_of_pdata() twice:
>
> leds = devm_kzalloc_objs(dev, *leds, num_leds);
> leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
> if (!leds)
> return -ENOMEM;
>
> The first line is the origin side, from commit 4dd10fbbeb9c ("treewide:
> Convert devm_kmalloc() family to the devm_kmalloc_obj() family"). The
> second is the leds-lj side: commit 41ea2c75f886 ("leds: netxbig: Fix
> platform device reference leak on successful probe") only changed the
> error path below it. The first array is never used and stays allocated
> until the device is unbound.
>
> Keep the devm_kzalloc_objs() call and drop the devm_kcalloc() one, as
> the merge does for the other allocations in this function.
>
> Fixes: 7fa58f4b0c86 ("Merge branch 'for-leds-next' of https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git")
> Link: https://lore.kernel.org/all/c05653b5-c8bd-46ca-aaf5-281e8d74f1e6@xxxxxxxxxxxxx/
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
> For folding into the leds-lj merge. Applies to next-20261130, built
> drivers/leds/leds-netxbig.o on x86_64 allmodconfig (clang 21, W=1).
I think this was Mark's -next patch.
> drivers/leds/leds-netxbig.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
> index 29ddebebfa37d..284f3bfad9cbe 100644
> --- a/drivers/leds/leds-netxbig.c
> +++ b/drivers/leds/leds-netxbig.c
> @@ -510,7 +510,6 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
> }
>
> leds = devm_kzalloc_objs(dev, *leds, num_leds);
> - leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
> if (!leds)
> return -ENOMEM;
>
>
> base-commit: 253f86660c1f882fbf554db5eaa34bc5d66dc7e8
> --
> 2.53.0
>
--
Lee Jones