pinctrl: don't print unavailable function groups
authorLudovic Desroches <ludovic.desroches@atmel.com>
Mon, 8 Jun 2015 15:16:37 +0000 (17:16 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 10 Jun 2015 08:44:05 +0000 (10:44 +0200)
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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinmux.c

index 77f82b23f7becb89db460a29b28bfa923b5139fc..e7ae890dcf1aed58faf752049e16609fb8a3809b 100644 (file)
@@ -557,9 +557,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++)