mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Kees Cook <kees@kernel.org>, Kees Cook <kees+treewide@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Wentao Liang <vulab@iscas.ac.cn>
Subject: Re: linux-next: manual merge of the leds-lj tree with the origin tree
Date: Fri, 27 Nov 2026 13:29:46 +0000	[thread overview]
Message-ID: <20261127132946.GT38590@joneslee-macbookpro.roam.internal> (raw)
In-Reply-To: <awBqIVPvQaRJN-bU@sirena.org.uk>

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

  reply	other threads:[~2026-11-27 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:41 Mark Brown
2026-11-27 13:29 ` Lee Jones [this message]
2026-11-27 15:10   ` Mark Brown
2026-11-27 15:01 Mark Brown
2026-11-27 15:01 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127132946.GT38590@joneslee-macbookpro.roam.internal \
    --to=lee@kernel.org \
    --cc=broonie@kernel.org \
    --cc=kees+treewide@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®