[PATCH 05/10] gpiolib: fix missing error check while query gpio-line-names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't ignore the possible error return code of
of_property_read_string_array().

Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux