diff mbox

pinctrl: don't try to print function groups if we can't get them

Message ID 1433776597-615-1-git-send-email-ludovic.desroches@atmel.com
State New
Headers show

Commit Message

ludovic.desroches@atmel.com June 8, 2015, 3:16 p.m. UTC
There is no reason to try to print groups associated to a function if
get_function_groups returns an error. Moreover, it can lead to a NULL
pointer dereference error.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/pinctrl/pinmux.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Linus Walleij June 10, 2015, 8:44 a.m. UTC | #1
On Mon, Jun 8, 2015 at 5:16 PM, Ludovic Desroches
<ludovic.desroches@atmel.com> wrote:

> There is no reason to try to print groups associated to a function if
> get_function_groups returns an error. Moreover, it can lead to a NULL
> pointer dereference error.
>
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index b874458..fd944e3 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -544,9 +544,12 @@  static int pinmux_functions_show(struct seq_file *s, void *what)
 
 		ret = pmxops->get_function_groups(pctldev, func_selector,
 						  &groups, &num_groups);
-		if (ret)
+		if (ret) {
 			seq_printf(s, "function %s: COULD NOT GET GROUPS\n",
 				   func);
+			func_selector++;
+			continue;
+		}
 
 		seq_printf(s, "function: %s, groups = [ ", func);
 		for (i = 0; i < num_groups; i++)