Re: linux-next: manual merge of the leds-lj tree with the origin tree

From: Lee Jones

Date: Fri Nov 27 2026 - 08:30:03 EST


On Fri, 20 Nov 2026, Mark Brown wrote:

> Hi all,
>
> Today's linux-next merge of the leds-lj tree got a conflict in:
>
> drivers/leds/leds-netxbig.c
>
> between commit:
>
> 4dd10fbbeb9c3 ("treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family")
>
> from the origin tree and commit:
>
> 41ea2c75f886d ("leds: netxbig: Fix platform device reference leak on successful probe")
>
> from the leds-lj tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>
> diff --cc drivers/leds/leds-netxbig.c
> index 6f59f91fac6c8,3a0456eae2c32..0000000000000
> --- a/drivers/leds/leds-netxbig.c
> +++ b/drivers/leds/leds-netxbig.c
> @@@ -461,32 -461,30 +461,29 @@@ static int netxbig_leds_get_of_pdata(st
> }
> gpio_ext_dev = &gpio_ext_pdev->dev;
>
> - gpio_ext = devm_kzalloc(dev, sizeof(*gpio_ext), GFP_KERNEL);
> + gpio_ext = devm_kzalloc_obj(dev, *gpio_ext);
> - if (!gpio_ext) {
> - of_node_put(gpio_ext_np);
> + if (!gpio_ext)
> ret = -ENOMEM;
> - goto put_device;
> - }
> - ret = netxbig_gpio_ext_get(dev, gpio_ext_dev, gpio_ext);
> + else
> + ret = netxbig_gpio_ext_get(dev, gpio_ext_dev, gpio_ext);
> +
> of_node_put(gpio_ext_np);
> + put_device(gpio_ext_dev);
> if (ret)
> - goto put_device;
> + return ret;
> +
> pdata->gpio_ext = gpio_ext;
>
> /* Timers (optional) */
> ret = of_property_count_u32_elems(np, "timers");
> if (ret > 0) {
> - if (ret % 3) {
> - ret = -EINVAL;
> - goto put_device;
> - }
> + if (ret % 3)
> + return -EINVAL;
>
> num_timers = ret / 3;
> - timers = devm_kcalloc(dev, num_timers, sizeof(*timers),
> - GFP_KERNEL);
> + timers = devm_kzalloc_objs(dev, *timers, num_timers);
> - if (!timers) {
> - ret = -ENOMEM;
> - goto put_device;
> - }
> + if (!timers)
> + return -ENOMEM;
> for (i = 0; i < num_timers; i++) {
> u32 tmp;
>
> @@@ -511,15 -507,12 +506,13 @@@
> num_leds = of_get_available_child_count(np);
> if (!num_leds) {
> dev_err(dev, "No LED subnodes found in DT\n");
> - ret = -ENODEV;
> - goto put_device;
> + return -ENODEV;
> }
>
> + leds = devm_kzalloc_objs(dev, *leds, num_leds);
> - if (!leds) {
> - ret = -ENOMEM;
> - goto put_device;
> - }
> + leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);

Doesn't this now reallocate leds?

> + if (!leds)
> + return -ENOMEM;
>
> led = leds;
> for_each_available_child_of_node_scoped(np, child) {
> @@@ -540,14 -533,14 +533,12 @@@
> ret = of_property_read_u32(child, "max-brightness",
> &led->bright_max);
> if (ret)
> - goto put_device;
> + return ret;
>
> mode_val =
> - devm_kcalloc(dev,
> - NETXBIG_LED_MODE_NUM, sizeof(*mode_val),
> - GFP_KERNEL);
> + devm_kzalloc_objs(dev, *mode_val, NETXBIG_LED_MODE_NUM);
> - if (!mode_val) {
> - ret = -ENOMEM;
> - goto put_device;
> - }
> + if (!mode_val)
> + return -ENOMEM;
>
> for (i = 0; i < NETXBIG_LED_MODE_NUM; i++)
> mode_val[i] = NETXBIG_LED_INVALID_MODE;



--
Lee Jones