linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: tegra: add missing error handling to probe
@ 2013-12-06 20:36 Stephen Warren
  2013-12-06 21:08 ` Thierry Reding
       [not found] ` <1386362171-29311-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Warren @ 2013-12-06 20:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-tegra, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

The call to gpiochip_add() is not currently error-checked. Add the
missing checking.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Perhaps this should be Cc: stable since Greg wants more stable patches,
but it's not a bug that's likely to be hit...
---
 drivers/gpio/gpio-tegra.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index cfd3b9037bc7..2b49f878b56c 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -425,6 +425,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 	struct tegra_gpio_soc_config *config;
 	struct resource *res;
 	struct tegra_gpio_bank *bank;
+	int ret;
 	int gpio;
 	int i;
 	int j;
@@ -494,7 +495,11 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 
 	tegra_gpio_chip.of_node = pdev->dev.of_node;
 
-	gpiochip_add(&tegra_gpio_chip);
+	ret = gpiochip_add(&tegra_gpio_chip);
+	if (ret < 0) {
+		irq_domain_remove(irq_domain);
+		return ret;
+	}
 
 	for (gpio = 0; gpio < tegra_gpio_chip.ngpio; gpio++) {
 		int irq = irq_create_mapping(irq_domain, gpio);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: tegra: add missing error handling to probe
  2013-12-06 20:36 [PATCH] gpio: tegra: add missing error handling to probe Stephen Warren
@ 2013-12-06 21:08 ` Thierry Reding
  2013-12-07  5:47   ` Alexandre Courbot
       [not found] ` <1386362171-29311-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2013-12-06 21:08 UTC (permalink / raw)
  To: Stephen Warren; +Cc: Linus Walleij, linux-gpio, linux-tegra, Stephen Warren

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

On Fri, Dec 06, 2013 at 01:36:11PM -0700, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> The call to gpiochip_add() is not currently error-checked. Add the
> missing checking.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> Perhaps this should be Cc: stable since Greg wants more stable patches,
> but it's not a bug that's likely to be hit...
> ---
>  drivers/gpio/gpio-tegra.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: tegra: add missing error handling to probe
  2013-12-06 21:08 ` Thierry Reding
@ 2013-12-07  5:47   ` Alexandre Courbot
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Courbot @ 2013-12-07  5:47 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Stephen Warren, Linus Walleij, linux-gpio@vger.kernel.org,
	linux-tegra@vger.kernel.org, Stephen Warren

On Sat, Dec 7, 2013 at 6:08 AM, Thierry Reding <thierry.reding@gmail.com> wrote:
> On Fri, Dec 06, 2013 at 01:36:11PM -0700, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The call to gpiochip_add() is not currently error-checked. Add the
>> missing checking.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> Perhaps this should be Cc: stable since Greg wants more stable patches,
>> but it's not a bug that's likely to be hit...
>> ---
>>  drivers/gpio/gpio-tegra.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: tegra: add missing error handling to probe
       [not found] ` <1386362171-29311-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2013-12-11 12:40   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2013-12-11 12:40 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren

On Fri, Dec 6, 2013 at 9:36 PM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:

> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> The call to gpiochip_add() is not currently error-checked. Add the
> missing checking.
>
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Patch applied and Reviewed-by tags added.

> Perhaps this should be Cc: stable since Greg wants more stable patches,
> but it's not a bug that's likely to be hit...

Nah.

> -       gpiochip_add(&tegra_gpio_chip);
> +       ret = gpiochip_add(&tegra_gpio_chip);
> +       if (ret < 0) {
> +               irq_domain_remove(irq_domain);
> +               return ret;
> +       }

I fear we are missing quite a few irq_domain_remove() calls in some
GPIO drivers ... adding to my TODO to do an overview of this.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-11 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-06 20:36 [PATCH] gpio: tegra: add missing error handling to probe Stephen Warren
2013-12-06 21:08 ` Thierry Reding
2013-12-07  5:47   ` Alexandre Courbot
     [not found] ` <1386362171-29311-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-11 12:40   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).