Commit f1b33ce4 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: stmpe: use gpiochip_dup_line_label()

Use the new gpiochip_dup_line_label() helper to safely retrieve the
descriptor label.
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent abeec1ad
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
*/ */
#include <linux/cleanup.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -255,7 +256,6 @@ static void stmpe_dbg_show_one(struct seq_file *s, ...@@ -255,7 +256,6 @@ static void stmpe_dbg_show_one(struct seq_file *s,
{ {
struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(gc); struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(gc);
struct stmpe *stmpe = stmpe_gpio->stmpe; struct stmpe *stmpe = stmpe_gpio->stmpe;
const char *label = gpiochip_is_requested(gc, offset);
bool val = !!stmpe_gpio_get(gc, offset); bool val = !!stmpe_gpio_get(gc, offset);
u8 bank = offset / 8; u8 bank = offset / 8;
u8 dir_reg = stmpe->regs[STMPE_IDX_GPDR_LSB + bank]; u8 dir_reg = stmpe->regs[STMPE_IDX_GPDR_LSB + bank];
...@@ -263,6 +263,10 @@ static void stmpe_dbg_show_one(struct seq_file *s, ...@@ -263,6 +263,10 @@ static void stmpe_dbg_show_one(struct seq_file *s,
int ret; int ret;
u8 dir; u8 dir;
char *label __free(kfree) = gpiochip_dup_line_label(gc, offset);
if (IS_ERR(label))
return;
ret = stmpe_reg_read(stmpe, dir_reg); ret = stmpe_reg_read(stmpe, dir_reg);
if (ret < 0) if (ret < 0)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment