[PATCH 05/10] gpiolib: fix missing error check while query gpio-line-names
Marco Felsch
m.felsch at pengutronix.de
Fri Jun 2 00:49:16 PDT 2023
Don't ignore the possible error return code of
of_property_read_string_array().
Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
drivers/gpio/gpiolib.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f05e2ac735..166356c85a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -526,8 +526,14 @@ static int of_gpiochip_scan_hogs(struct gpio_chip *chip)
if (count > 0) {
const char **names = xzalloc(count * sizeof(char *));
- of_property_read_string_array(chip->dev->of_node,
- "gpio-line-names", names, count);
+ ret = of_property_read_string_array(chip->dev->of_node,
+ "gpio-line-names", names,
+ count);
+ if (ret < 0) {
+ dev_warn(chip->dev, "failed to read GPIO line names\n");
+ kfree(names);
+ return ret;
+ }
/*
* Since property 'gpio-line-names' cannot contains gaps, we
--
2.39.2
More information about the barebox
mailing list