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: <20220223080858.GJ9136@pengutronix.de>
Date:   Wed, 23 Feb 2022 09:08:58 +0100
From:   Sascha Hauer <s.hauer@...gutronix.de>
To:     linux-pm@...r.kernel.org
Cc:     Kevin Hilman <khilman@...nel.org>,
        Ahmad Fatoum <a.fatoum@...gutronix.de>,
        linux-kernel@...r.kernel.org, kernel@...gutronix.de,
        "Rafael J . Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] PM: domains: use dev_err_probe() to simplify error
 handling

On Wed, Feb 23, 2022 at 09:03:23AM +0100, Sascha Hauer wrote:
> From: Ahmad Fatoum <a.fatoum@...gutronix.de>
> 
> dev_err_probe() can reduce code size, makes the code easier to read
> and has the added benefit of recording the defer reason for later
> read out. Use it where appropriate.
> 
> This also fixes an issue, where an error message in __genpd_dev_pm_attach
> was not terminated by a line break.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
> ---
>  drivers/base/power/domain.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)

And of course:

Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>

Sascha

> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 5db704f02e712..29428ae91349d 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2248,12 +2248,8 @@ int of_genpd_add_provider_simple(struct device_node *np,
>  	/* Parse genpd OPP table */
>  	if (genpd->set_performance_state) {
>  		ret = dev_pm_opp_of_add_table(&genpd->dev);
> -		if (ret) {
> -			if (ret != -EPROBE_DEFER)
> -				dev_err(&genpd->dev, "Failed to add OPP table: %d\n",
> -					ret);
> -			return ret;
> -		}
> +		if (ret)
> +			return dev_err_probe(&genpd->dev, ret, "Failed to add OPP table\n");
>  
>  		/*
>  		 * Save table for faster processing while setting performance
> @@ -2312,9 +2308,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,
>  		if (genpd->set_performance_state) {
>  			ret = dev_pm_opp_of_add_table_indexed(&genpd->dev, i);
>  			if (ret) {
> -				if (ret != -EPROBE_DEFER)
> -					dev_err(&genpd->dev, "Failed to add OPP table for index %d: %d\n",
> -						i, ret);
> +				dev_err_probe(&genpd->dev, ret,
> +					      "Failed to add OPP table for index %d\n", i);
>  				goto error;
>  			}
>  
> @@ -2672,12 +2667,8 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
>  	ret = genpd_add_device(pd, dev, base_dev);
>  	mutex_unlock(&gpd_list_lock);
>  
> -	if (ret < 0) {
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "failed to add to PM domain %s: %d",
> -				pd->name, ret);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "failed to add to PM domain %s\n", pd->name);
>  
>  	dev->pm_domain->detach = genpd_dev_pm_detach;
>  	dev->pm_domain->sync = genpd_dev_pm_sync;
> -- 
> 2.30.2
> 
> 
> 

-- 
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 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ