All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	"maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." 
	<bcm-kernel-feedback-list@broadcom.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Phil Elwell <phil@raspberrypi.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Jason Wang <wangborong@cdjrlc.com>, Marc Zyngier <maz@kernel.org>,
	"open list:PIN CONTROL SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
	<linux-rpi-kernel@lists.infradead.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] pinctrl: bcm2835: Fix a few error paths
Date: Fri, 28 Jan 2022 16:35:58 +0200	[thread overview]
Message-ID: <YfP/TuEERCrgst+k@smile.fi.intel.com> (raw)
In-Reply-To: <20220127215033.267227-1-f.fainelli@gmail.com>

On Thu, Jan 27, 2022 at 01:50:31PM -0800, Florian Fainelli wrote:
> After commit 266423e60ea1 ("pinctrl: bcm2835: Change init order for gpio
> hogs") a few error paths would not unwind properly the registration of
> gpio ranges. Correct that by assigning a single error label and goto it
> whenever we encounter a fatal error.

>  1 file changed, 15 insertions(+), 8 deletions(-)

While this seems legit per se, my eyes caught this:


>  	if (!girq->parents) {
> -		pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
> -		return -ENOMEM;
> +		err = -ENOMEM;
> +		goto out_remove;

Non-devm....

>  	}
>  
>  	if (is_7211) {
>  		pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
>  					    sizeof(*pc->wake_irq),
>  					    GFP_KERNEL);

...followed by devm.

It means more ordering bugs in the ->remove() and error path are lurking
around. Can you double check and be sure that we do not have a case where
non-devm registration code followed by devm?

If that is the case it has to be fixed as well.

> -		if (!pc->wake_irq)
> -			return -ENOMEM;
> +		if (!pc->wake_irq) {
> +			err = -ENOMEM;
> +			goto out_remove;
> +		}
>  	}


-- 
With Best Regards,
Andy Shevchenko



WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	"maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..."
	<bcm-kernel-feedback-list@broadcom.com>,
	 Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Phil Elwell <phil@raspberrypi.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Jason Wang <wangborong@cdjrlc.com>, Marc Zyngier <maz@kernel.org>,
	"open list:PIN CONTROL SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-rpi-kernel@lists.infradead.org>,
	 "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] pinctrl: bcm2835: Fix a few error paths
Date: Fri, 28 Jan 2022 16:35:58 +0200	[thread overview]
Message-ID: <YfP/TuEERCrgst+k@smile.fi.intel.com> (raw)
In-Reply-To: <20220127215033.267227-1-f.fainelli@gmail.com>

On Thu, Jan 27, 2022 at 01:50:31PM -0800, Florian Fainelli wrote:
> After commit 266423e60ea1 ("pinctrl: bcm2835: Change init order for gpio
> hogs") a few error paths would not unwind properly the registration of
> gpio ranges. Correct that by assigning a single error label and goto it
> whenever we encounter a fatal error.

>  1 file changed, 15 insertions(+), 8 deletions(-)

While this seems legit per se, my eyes caught this:


>  	if (!girq->parents) {
> -		pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
> -		return -ENOMEM;
> +		err = -ENOMEM;
> +		goto out_remove;

Non-devm....

>  	}
>  
>  	if (is_7211) {
>  		pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
>  					    sizeof(*pc->wake_irq),
>  					    GFP_KERNEL);

...followed by devm.

It means more ordering bugs in the ->remove() and error path are lurking
around. Can you double check and be sure that we do not have a case where
non-devm registration code followed by devm?

If that is the case it has to be fixed as well.

> -		if (!pc->wake_irq)
> -			return -ENOMEM;
> +		if (!pc->wake_irq) {
> +			err = -ENOMEM;
> +			goto out_remove;
> +		}
>  	}


-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-01-28 14:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 21:50 [PATCH] pinctrl: bcm2835: Fix a few error paths Florian Fainelli
2022-01-27 21:50 ` Florian Fainelli
2022-01-28 14:35 ` Andy Shevchenko [this message]
2022-01-28 14:35   ` Andy Shevchenko
2022-01-28 16:12   ` Florian Fainelli
2022-01-28 16:12     ` Florian Fainelli
2022-01-28 16:26     ` Andy Shevchenko
2022-01-28 16:26       ` Andy Shevchenko
2022-01-30  1:34 ` Linus Walleij
2022-01-30  1:34   ` Linus Walleij

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=YfP/TuEERCrgst+k@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=nsaenz@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=wangborong@cdjrlc.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.