lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <49F7228C-0EE6-4202-A2AF-A023B4A4DE4B@gmail.com>
Date: Wed, 27 Aug 2025 14:37:47 -0400
From: Jean-François Lessard <jefflessard3@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
CC: Andy Shevchenko <andy@...nel.org>, Geert Uytterhoeven <geert@...ux-m68k.org>,
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>, linux-kernel@...r.kernel.org,
 linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
 Paolo Sabatino <paolo.sabatino@...il.com>,
 Christian Hewitt <christianshewitt@...il.com>,
 Boris Gjenero <boris.gjenero@...il.com>,
 Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Subject: Re: [PATCH v4 3/6] auxdisplay: Add TM16xx 7-segment LED matrix display controllers driver

Le 25 août 2025 13 h 48 min 45 s HAE, "Jean-François Lessard" <jefflessard3@...il.com> a écrit :
>Le 25 août 2025 11 h 14 min 21 s HAE, Andy Shevchenko <andriy.shevchenko@...el.com> a écrit :
>>On Sun, Aug 24, 2025 at 11:32:29PM -0400, Jean-François Lessard wrote:

...

>>> +		fwnode_for_each_child_node(digits_node, child)
>>> +			display->num_digits++;
>>
>>Don't we have a _count API for this?
>>
>
>I'll use device_get_child_node_count() instead of manual counting loops.
>
>>> +		dev_dbg(dev, "Number of digits: %u\n", display->num_digits);
>>> +
>>> +		if (display->num_digits) {
>>> +			display->digits = devm_kcalloc(dev, display->num_digits,
>>> +						       sizeof(*display->digits),
>>> +						       GFP_KERNEL);
>>> +			if (!display->digits) {
>>
>>> +				fwnode_handle_put(digits_node);
>>
>>Use RAII instead, we have defined __free() method for this.
>>
>>> +				return -ENOMEM;
>>> +			}
>>> +
>>> +			i = 0;
>>> +			fwnode_for_each_child_node(digits_node, child) {
>>
>>Ditto. Use _scoped variant.
>>
>
>Well received.
>

After further investigation, _scoped variant exists for
device_for_each_child_node_scoped() but not for fwnode_for_each_child_node().

I suggest to include an additional patch in next submission to add to
include/linux/property.h:

#define fwnode_for_each_child_node_scoped(fwnode, child)		\
	for (struct fwnode_handle *child __free(fwnode_handle) =	\
		fwnode_get_next_child_node(fwnode, NULL);		\
	     child; child = fwnode_get_next_child_node(fwnode, child))

#define fwnode_for_each_named_child_node_scoped(fwnode, child, name)	\
	fwnode_for_each_child_node_scoped(fwnode, child)		\
		for_each_if(fwnode_name_eq(child, name))

#define fwnode_for_each_available_child_node_scoped(fwnode, child)	\
	for (struct fwnode_handle *child __free(fwnode_handle) =	\
		fwnode_get_next_available_child_node(fwnode, NULL);	\
	     child; child = fwnode_get_next_available_child_node(fwnode, child))

...


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ