From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2 4/4] net: airoha: Use dev_err_probe()
Date: Thu, 8 May 2025 18:00:15 +0200 [thread overview]
Message-ID: <aeab63d4-9740-4213-86c3-ca975762046e@wanadoo.fr> (raw)
In-Reply-To: <aBzROQyQ_5oHmYr3@lore-desk>
Le 08/05/2025 à 17:43, Lorenzo Bianconi a écrit :
> On May 08, Christophe JAILLET wrote:
>> Use dev_err_probe() to slightly simplify the code.
>> It is less verbose, more informational and makes error logging more
>> consistent in the probe.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Changes in v2:
>> - New patch
>>
>> Compile tested only.
>> ---
>> drivers/net/ethernet/airoha/airoha_eth.c | 21 +++++++++------------
>> 1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
>> index 2335aa59b06f..7404ee894467 100644
>> --- a/drivers/net/ethernet/airoha/airoha_eth.c
>> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
>> @@ -2896,10 +2896,9 @@ static int airoha_probe(struct platform_device *pdev)
>> eth->dev = &pdev->dev;
>>
>> err = dma_set_mask_and_coherent(eth->dev, DMA_BIT_MASK(32));
>> - if (err) {
>> - dev_err(eth->dev, "failed configuring DMA mask\n");
>> - return err;
>> - }
>> + if (err)
>> + return dev_err_probe(eth->dev, err,
>> + "failed configuring DMA mask\n");
>
> Can dma_set_mask_and_coherent() return -EPROBE_DEFER? The other parts are fine.
>
> Regards,
> Lorenzo
>
No, it can't, but using dev_err_probe() does not hurt.
Using dev_err_probe():
- saves 1 LoC
- is consistent in the function
- log the error code in a human readable format
- generate smaller binaries (can easily be checked with size)
So, even if "unneeded", I think it is still a improvement.
CJ
next prev parent reply other threads:[~2025-05-08 17:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 14:52 [PATCH v2 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Christophe JAILLET
2025-05-08 14:52 ` [PATCH v2 2/4] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
2025-05-08 15:10 ` Lorenzo Bianconi
2025-05-08 15:21 ` Christophe JAILLET
2025-05-08 14:52 ` [PATCH v2 3/4] net: airoha: Use for_each_child_of_node_scoped() Christophe JAILLET
2025-05-08 14:52 ` [PATCH v2 4/4] net: airoha: Use dev_err_probe() Christophe JAILLET
2025-05-08 15:43 ` Lorenzo Bianconi
2025-05-08 16:00 ` Christophe JAILLET [this message]
2025-05-08 15:31 ` [PATCH v2 1/4] net: airoha: Fix an error handling path in airoha_alloc_gdm_port() Lorenzo Bianconi
2025-05-08 16:05 ` Christophe JAILLET
2025-05-10 8:20 ` Lorenzo Bianconi
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=aeab63d4-9740-4213-86c3-ca975762046e@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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