···88 *99 */10101111+#include <linux/cleanup.h>1112#include <linux/kernel.h>1213#include <linux/slab.h>1314#include <linux/module.h>···161160 for (i = 0; i < chip->ngpio; i++) {162161 int gpio = i + chip->base;163162 int reg;164164- const char *label, *pull, *powerdomain;163163+ const char *pull, *powerdomain;165164166165 /* We report the GPIO even if it's not requested since167166 * we're also reporting things like alternate168167 * functions which apply even when the GPIO is not in169168 * use as a GPIO.170169 */171171- label = gpiochip_is_requested(chip, i);172172- if (!label)173173- label = "Unrequested";170170+ char *label __free(kfree) = gpiochip_dup_line_label(chip, i);171171+ if (IS_ERR(label)) {172172+ dev_err(wm831x->dev, "Failed to duplicate label\n");173173+ continue;174174+ }174175175175- seq_printf(s, " gpio-%-3d (%-20.20s) ", gpio, label);176176+ seq_printf(s, " gpio-%-3d (%-20.20s) ",177177+ gpio, label ?: "Unrequested");176178177179 reg = wm831x_reg_read(wm831x, WM831X_GPIO1_CONTROL + i);178180 if (reg < 0) {