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

pinctrl: abx500: 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>
Acked-by: Linus Walleij <linus.walleij@linaro.org>

+7 -2
+7 -2
drivers/pinctrl/nomadik/pinctrl-abx500.c
··· 6 6 * 7 7 * Driver allows to use AxB5xx unused pins to be used as GPIO 8 8 */ 9 + 9 10 #include <linux/bitops.h> 11 + #include <linux/cleanup.h> 10 12 #include <linux/err.h> 11 13 #include <linux/gpio/driver.h> 12 14 #include <linux/init.h> ··· 455 453 unsigned offset, unsigned gpio) 456 454 { 457 455 struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev); 458 - const char *label = gpiochip_is_requested(chip, offset - 1); 459 456 u8 gpio_offset = offset - 1; 460 457 int mode = -1; 461 458 bool is_out; 462 459 bool pd; 463 - int ret; 460 + int ret = -ENOMEM; 464 461 465 462 const char *modes[] = { 466 463 [ABX500_DEFAULT] = "default", ··· 474 473 [ABX500_GPIO_PULL_NONE + 1] = "pull none", 475 474 [ABX500_GPIO_PULL_UP] = "pull up", 476 475 }; 476 + 477 + char *label __free(kfree) = gpiochip_dup_line_label(chip, offset - 1); 478 + if (IS_ERR(label)) 479 + goto out; 477 480 478 481 ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, 479 482 gpio_offset, &is_out);