Skip to content

Commit

Permalink
gpio: stmpe: 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 abeec1a commit f1b33ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/gpio/gpio-stmpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
*/

#include <linux/cleanup.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -255,14 +256,17 @@ static void stmpe_dbg_show_one(struct seq_file *s,
{
struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(gc);
struct stmpe *stmpe = stmpe_gpio->stmpe;
const char *label = gpiochip_is_requested(gc, offset);
bool val = !!stmpe_gpio_get(gc, offset);
u8 bank = offset / 8;
u8 dir_reg = stmpe->regs[STMPE_IDX_GPDR_LSB + bank];
u8 mask = BIT(offset % 8);
int ret;
u8 dir;

char *label __free(kfree) = gpiochip_dup_line_label(gc, offset);
if (IS_ERR(label))
return;

ret = stmpe_reg_read(stmpe, dir_reg);
if (ret < 0)
return;
Expand Down

0 comments on commit f1b33ce

Please sign in to comment.