Skip to content

Commit

Permalink
pinctrl: abx500: use gpiochip_dup_line_label()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bartosz Golaszewski committed Dec 8, 2023
1 parent f1b33ce commit c76ba93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/pinctrl/nomadik/pinctrl-abx500.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*
* Driver allows to use AxB5xx unused pins to be used as GPIO
*/

#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
#include <linux/init.h>
Expand Down Expand Up @@ -453,12 +455,11 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
unsigned offset, unsigned gpio)
{
struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
const char *label = gpiochip_is_requested(chip, offset - 1);
u8 gpio_offset = offset - 1;
int mode = -1;
bool is_out;
bool pd;
int ret;
int ret = -ENOMEM;

const char *modes[] = {
[ABX500_DEFAULT] = "default",
Expand All @@ -474,6 +475,10 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
[ABX500_GPIO_PULL_UP] = "pull up",
};

char *label __free(kfree) = gpiochip_dup_line_label(chip, offset - 1);
if (IS_ERR(label))
goto out;

ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG,
gpio_offset, &is_out);
if (ret < 0)
Expand Down

0 comments on commit c76ba93

Please sign in to comment.