linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio-sta2x11: don't use pdata if null
@ 2012-05-27 20:55 Alessandro Rubini
  2012-07-05 12:29 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Alessandro Rubini @ 2012-05-27 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Giancarlo Asnaghi, Grant Likely, Linus Walleij, Samuel Ortiz

If there is no platform data available, the driver shouldn't use the
pointer or it will oops.  Since things will mostly work nonetheless,
(the BIOS may have set up the pins properly), I'd better not fail the
probe even in this case.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
---

(yes, I'm aware I have to patch this file to use irq_domain_add_linear)

 drivers/gpio/gpio-sta2x11.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c
index 38416be..6064fb3 100644
--- a/drivers/gpio/gpio-sta2x11.c
+++ b/drivers/gpio/gpio-sta2x11.c
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev)
 	}
 	spin_lock_init(&chip->lock);
 	gsta_gpio_setup(chip);
-	for (i = 0; i < GSTA_NR_GPIO; i++)
-		gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
+	if (gpio_pdata)
+		for (i = 0; i < GSTA_NR_GPIO; i++)
+			gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
 
 	/* 384 was used in previous code: be compatible for other drivers */
 	err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE);
-- 
1.7.7.2

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

* Re: [PATCH] gpio-sta2x11: don't use pdata if null
  2012-05-27 20:55 [PATCH] gpio-sta2x11: don't use pdata if null Alessandro Rubini
@ 2012-07-05 12:29 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2012-07-05 12:29 UTC (permalink / raw)
  To: Alessandro Rubini
  Cc: linux-kernel, Giancarlo Asnaghi, Grant Likely, Linus Walleij,
	Samuel Ortiz

On Sun, May 27, 2012 at 10:55 PM, Alessandro Rubini <rubini@gnudd.com> wrote:

> If there is no platform data available, the driver shouldn't use the
> pointer or it will oops.  Since things will mostly work nonetheless,
> (the BIOS may have set up the pins properly), I'd better not fail the
> probe even in this case.
>
> Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
> Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>

Applied.

Thanks,
Linus Walleij

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

end of thread, other threads:[~2012-07-05 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 20:55 [PATCH] gpio-sta2x11: don't use pdata if null Alessandro Rubini
2012-07-05 12:29 ` 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).