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] [day] [month] [year] [list]
Message-ID: <7def0a1a-5aa6-48e6-96d9-0957ea44ef04@datenfreihafen.org>
Date: Fri, 30 Aug 2024 22:36:44 +0200
From: Stefan Schmidt <stefan@...enfreihafen.org>
To: Shen Lichuan <shenlichuan@...o.com>, alex.aring@...il.com,
 miquel.raynal@...tlin.com, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, pabeni@...hat.com
Cc: linux-wpan@...r.kernel.org, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH v1] ieee802154: at86rf230: Simplify with dev_err_probe()

Hello Shen,

On 8/30/24 10:14 AM, Shen Lichuan wrote:
> Use dev_err_probe() to simplify the error path and unify a message
> template.
> 
> Using this helper is totally fine even if err is known to never
> be -EPROBE_DEFER.
> 
> The benefit compared to a normal dev_err() is the standardized format
> of the error code, it being emitted symbolically and the fact that
> the error code is returned which allows more compact error paths.
> 
> Signed-off-by: Shen Lichuan <shenlichuan@...o.com>
> ---
>   drivers/net/ieee802154/at86rf230.c | 13 +++++--------
>   1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
> index f632b0cfd5ae..3fb536734034 100644
> --- a/drivers/net/ieee802154/at86rf230.c
> +++ b/drivers/net/ieee802154/at86rf230.c
> @@ -1532,11 +1532,9 @@ static int at86rf230_probe(struct spi_device *spi)
>   
>   	rc = device_property_read_u8(&spi->dev, "xtal-trim", &xtal_trim);
>   	if (rc < 0) {
> -		if (rc != -EINVAL) {
> -			dev_err(&spi->dev,
> -				"failed to parse xtal-trim: %d\n", rc);
> -			return rc;
> -		}
> +		if (rc != -EINVAL)
> +			return dev_err_probe(&spi->dev, rc,
> +					     "failed to parse xtal-trim\n");
>   		xtal_trim = 0;
>   	}
>   
> @@ -1576,9 +1574,8 @@ static int at86rf230_probe(struct spi_device *spi)
>   
>   	lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config);
>   	if (IS_ERR(lp->regmap)) {
> -		rc = PTR_ERR(lp->regmap);
> -		dev_err(&spi->dev, "Failed to allocate register map: %d\n",
> -			rc);
> +		dev_err_probe(&spi->dev, PTR_ERR(lp->regmap),
> +			      "Failed to allocate register map\n");
>   		goto free_dev;
>   	}
>   

Please take the review from Simon into account here. Dropped this 
version of the patch from the wpan patchwork queue.

regards
Stefan Schmidt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ