Skip to contentSkip to conversation

pinctrl: madera: Fix possible NULL pointer with pdata config

PATCH In review Richard Fitzgerald 2 participants 2 messages Aug 28, 2018 – Aug 29, 2018

Subsystems (3)
lore
Share & tools
lore

Richard Fitzgerald

author maintainer
#0 lore raw

PATCH 1/1 pinctrl: madera: Fix possible NULL pointer with pdata config

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.

---
 drivers/pinctrl/cirrus/pinctrl-madera-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/cirrus/pinctrl-madera-core.c +1 -1
index ece41fb2848f..c4f4d904e4a6 100644
@@ -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) {
Signature · 1 line
2.11.0
#1 lore raw
Quoted 5 lines · 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.

Patch applied for fixes.

Yours,
Linus Walleij