netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Shen Lichuan <shenlichuan@vivo.com>
Cc: alex.aring@gmail.com, stefan@datenfreihafen.org,
	miquel.raynal@bootlin.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux-wpan@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v1] ieee802154: at86rf230: Simplify with dev_err_probe()
Date: Fri, 30 Aug 2024 17:02:28 +0100	[thread overview]
Message-ID: <20240830160228.GU1368797@kernel.org> (raw)
In-Reply-To: <20240830081402.21716-1-shenlichuan@vivo.com>

On Fri, Aug 30, 2024 at 04:14:02PM +0800, 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@vivo.com>

...

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

After branching to dev_free the function will return rc.
So I think it still needs to be set a in this error path.

-- 
pw-bot: cr

  reply	other threads:[~2024-08-30 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30  8:14 [PATCH v1] ieee802154: at86rf230: Simplify with dev_err_probe() Shen Lichuan
2024-08-30 16:02 ` Simon Horman [this message]
2024-08-30 17:43   ` Krzysztof Kozlowski
2024-08-30 18:16     ` Simon Horman
2024-08-30 18:27       ` Krzysztof Kozlowski
2024-08-30 18:33         ` Simon Horman
2024-08-30 20:36 ` Stefan Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240830160228.GU1368797@kernel.org \
    --to=horms@kernel.org \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=pabeni@redhat.com \
    --cc=shenlichuan@vivo.com \
    --cc=stefan@datenfreihafen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).