[PATCH 05/10] gpiolib: fix missing error check while query gpio-line-names
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Jun 13 00:43:46 PDT 2023
On 02.06.23 09:49, Marco Felsch wrote:
> Don't ignore the possible error return code of
> of_property_read_string_array().
>
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
I know the kernel does it this way, but IMO this can't fail if
of_property_count_strings() called before it succeeded.
I'd suggest we drop this or if you feel strongly about this
drop just the never hit warning message.
> ---
> 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
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list