Просмотр исходного кода

pinctrl: don't print unavailable function groups

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>
Ludovic Desroches 10 лет назад
Родитель
Сommit
9d7ebbbf22
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      drivers/pinctrl/pinmux.c

+ 4 - 1
drivers/pinctrl/pinmux.c

@@ -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++)