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] [thread-next>] [day] [month] [year] [list]
Message-ID: <3415996d-e8b5-2416-fb66-e65779a9b507@omp.ru>
Date:   Sat, 26 Mar 2022 11:41:31 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Gregory CLEMENT <gregory.clement@...tlin.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Fabien Dessenne <fabien.dessenne@...s.st.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        <linux-gpio@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-amlogic@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>,
        <linux-renesas-soc@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>
CC:     Neil Armstrong <narmstrong@...libre.com>,
        Kevin Hilman <khilman@...libre.com>,
        Jerome Brunet <jbrunet@...libre.com>,
        "Martin Blumenstingl" <martin.blumenstingl@...glemail.com>,
        Andrew Lunn <andrew@...n.ch>,
        Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Bartosz Golaszewski <brgl@...ev.pl>
Subject: Re: [PATCH v1 5/5] pinctrl: armada-37xx: Replace custom code by
 gpiochip_count() call

Hello!

On 3/25/22 11:03 PM, Andy Shevchenko wrote:

> Since we have generic function to count GPIO controller nodes
> under given device, there is no need to open code it. Replace
> custom code by gpiochip_count() call.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 24 +++++++++------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> index 08cad14042e2..ba94125f6566 100644
> --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> @@ -728,22 +728,18 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
>  	struct gpio_irq_chip *girq = &gc->irq;
>  	struct device *dev = &pdev->dev;
>  	struct device_node *np;
> -	int ret = -ENODEV, i, nr_irq_parent;
> +	unsigned int nr_child_nodes, i;
> +	int ret;
>  
>  	/* Check if we have at least one gpio-controller child node */
> -	for_each_child_of_node(dev->of_node, np) {
> -		if (of_property_read_bool(np, "gpio-controller")) {
> -			ret = 0;
> -			break;
> -		}
> -	}
> -	if (ret)
> -		return dev_err_probe(dev, ret, "no gpio-controller child node\n");
> +	nr_child_nodes = gpiochip_count(dev);
> +	if (!nr_child_nodes)
> +		return dev_err_probe(dev, -ENODEV, "no gpio-controller child node\n");
>  
> -	nr_irq_parent = of_irq_count(np);
>  	spin_lock_init(&info->irq_lock);
>  
> -	if (!nr_irq_parent) {
> +	nr_child_nodes = of_irq_count(np);

   Mhm, 'np' is no longer assigned to at this point...

> +	if (!nr_child_nodes) {
>  		dev_err(dev, "invalid or no IRQ\n");
>  		return 0;
>  	}
[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ