lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6fe3dbb8-255d-35f7-076a-039ab032ac7f@kaa.org.ua>
Date:   Fri, 28 May 2021 23:59:00 +0300
From:   Oleh Kravchenko <oleg@....org.ua>
To:     Andy Shevchenko <andy.shevchenko@...il.com>,
        Pavel Machek <pavel@....cz>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Amireddy Mallikarjuna reddy 
        <mallikarjunax.reddy@...ux.intel.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Marek Behún <marek.behun@....cz>,
        Abanoub Sameh <abanoubsameh8@...il.com>,
        Dan Murphy <dmurphy@...com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 04/28] leds: el15203000: Make error handling more
 robust



10.05.21 12:50, Andy Shevchenko пише:
> It's easy to miss necessary clean up, e.g. firmware node reference counting,
> during error path in ->probe(). Make it more robust by moving to a single
> point of return.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@...il.com>
> ---
>  drivers/leds/leds-el15203000.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/leds/leds-el15203000.c b/drivers/leds/leds-el15203000.c
> index 912451db05e6..bcdbbbc9c187 100644
> --- a/drivers/leds/leds-el15203000.c
> +++ b/drivers/leds/leds-el15203000.c
> @@ -246,16 +246,13 @@ static int el15203000_probe_dt(struct el15203000 *priv)
>  		ret = fwnode_property_read_u32(child, "reg", &led->reg);
>  		if (ret) {
>  			dev_err(priv->dev, "LED without ID number");
> -			fwnode_handle_put(child);
> -
> -			break;
> +			goto err_child_out;
>  		}
>  
>  		if (led->reg > U8_MAX) {
>  			dev_err(priv->dev, "LED value %d is invalid", led->reg);
> -			fwnode_handle_put(child);
> -
> -			return -EINVAL;
> +			ret = -EINVAL;
> +			goto err_child_out;
>  		}
>  
>  		led->priv			  = priv;
> @@ -277,14 +274,16 @@ static int el15203000_probe_dt(struct el15203000 *priv)
>  			dev_err(priv->dev,
>  				"failed to register LED device %s, err %d",
>  				led->ldev.name, ret);
> -			fwnode_handle_put(child);
> -
> -			break;
> +			goto err_child_out;
>  		}
>  
>  		led++;
>  	}
>  
> +	return 0;
> +
> +err_child_out:
> +	fwnode_handle_put(child);
>  	return ret;
>  }
>  
> 

Reviewed-by: Oleh Kravchenko <oleg@....org.ua>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ