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: <aeab63d4-9740-4213-86c3-ca975762046e@wanadoo.fr>
Date: Thu, 8 May 2025 18:00:15 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
 netdev@...r.kernel.org
Subject: Re: [PATCH v2 4/4] net: airoha: Use dev_err_probe()

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@...adoo.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ