linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: madera: Fix possible NULL pointer with pdata config
@ 2018-08-28  8:45 Richard Fitzgerald
  2018-08-29 12:03 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2018-08-28  8:45 UTC (permalink / raw)
  To: linus.walleij; +Cc: patches, linux-gpio, linux-kernel, Richard Fitzgerald

If we are being configured via pdata we don't necessarily have
any gpio mappings being configured that way so pdata->gpio_config
could be NULL.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 drivers/pinctrl/cirrus/pinctrl-madera-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c
index ece41fb2848f..c4f4d904e4a6 100644
--- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c
+++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c
@@ -1040,7 +1040,7 @@ static int madera_pin_probe(struct platform_device *pdev)
 	}
 
 	/* if the configuration is provided through pdata, apply it */
-	if (pdata) {
+	if (pdata && pdata->gpio_configs) {
 		ret = pinctrl_register_mappings(pdata->gpio_configs,
 						pdata->n_gpio_configs);
 		if (ret) {
-- 
2.11.0


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

* Re: [PATCH] pinctrl: madera: Fix possible NULL pointer with pdata config
  2018-08-28  8:45 [PATCH] pinctrl: madera: Fix possible NULL pointer with pdata config Richard Fitzgerald
@ 2018-08-29 12:03 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2018-08-29 12:03 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: patches, open list:GPIO SUBSYSTEM, linux-kernel

On Tue, Aug 28, 2018 at 10:45 AM Richard Fitzgerald
<rf@opensource.cirrus.com> wrote:

> If we are being configured via pdata we don't necessarily have
> any gpio mappings being configured that way so pdata->gpio_config
> could be NULL.
>
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

end of thread, other threads:[~2018-08-29 12:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28  8:45 [PATCH] pinctrl: madera: Fix possible NULL pointer with pdata config Richard Fitzgerald
2018-08-29 12:03 ` 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).