Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: baytrail: use gpiochip_dup_line_label()

Use the new gpiochip_dup_line_label() helper to safely retrieve the
descriptor label.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>

+6 -5
+6 -5
drivers/pinctrl/intel/pinctrl-baytrail.c
··· 9 9 #include <linux/acpi.h> 10 10 #include <linux/array_size.h> 11 11 #include <linux/bitops.h> 12 + #include <linux/cleanup.h> 12 13 #include <linux/gpio/driver.h> 13 14 #include <linux/init.h> 14 15 #include <linux/interrupt.h> ··· 1174 1173 const char *pull_str = NULL; 1175 1174 const char *pull = NULL; 1176 1175 unsigned long flags; 1177 - const char *label; 1178 1176 unsigned int pin; 1179 1177 1180 1178 pin = vg->soc->pins[i].number; ··· 1200 1200 seq_printf(s, "Pin %i: can't retrieve community\n", pin); 1201 1201 continue; 1202 1202 } 1203 - label = gpiochip_is_requested(chip, i); 1204 - if (!label) 1205 - label = "Unrequested"; 1203 + 1204 + char *label __free(kfree) = gpiochip_dup_line_label(chip, i); 1205 + if (IS_ERR(label)) 1206 + continue; 1206 1207 1207 1208 switch (conf0 & BYT_PULL_ASSIGN_MASK) { 1208 1209 case BYT_PULL_ASSIGN_UP: ··· 1232 1231 seq_printf(s, 1233 1232 " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s", 1234 1233 pin, 1235 - label, 1234 + label ?: "Unrequested", 1236 1235 val & BYT_INPUT_EN ? " " : "in", 1237 1236 val & BYT_OUTPUT_EN ? " " : "out", 1238 1237 str_hi_lo(val & BYT_LEVEL),