From: Marco Felsch <[email protected]>

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

Signed-off-by: Marco Felsch <[email protected]>
Signed-off-by: Ahmad Fatoum <[email protected]>
---
v1 -> v2:
  - drop error message as we shouldn't hit this issue
    anyway when of_property_count_strings called before
    succeeds.
---
 drivers/gpio/gpiolib.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f05e2ac7356a..275fb7324331 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -526,8 +526,13 @@ 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) {
+                       kfree(names);
+                       return ret;
+               }
 
                /*
                 * Since property 'gpio-line-names' cannot contains gaps, we
-- 
2.39.2


Reply via email to