linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: rt2x00: Remove the use of dev_err_probe()
@ 2025-08-20  8:58 Xichao Zhao
  2025-08-22  7:44 ` Stanislaw Gruszka
  0 siblings, 1 reply; 2+ messages in thread
From: Xichao Zhao @ 2025-08-20  8:58 UTC (permalink / raw)
  To: stf_xl; +Cc: linux-wireless, linux-kernel, Xichao Zhao

The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
Therefore, remove the useless call to dev_err_probe(), and just
return the value instead.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index 8f510a84e7f1..e5c99fc6509b 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -289,7 +289,7 @@ static int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops
 
 	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
 	if (!hw)
-		return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate hardware");
+		return -ENOMEM;
 
 	platform_set_drvdata(pdev, hw);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: rt2x00: Remove the use of dev_err_probe()
  2025-08-20  8:58 [PATCH] wifi: rt2x00: Remove the use of dev_err_probe() Xichao Zhao
@ 2025-08-22  7:44 ` Stanislaw Gruszka
  0 siblings, 0 replies; 2+ messages in thread
From: Stanislaw Gruszka @ 2025-08-22  7:44 UTC (permalink / raw)
  To: Xichao Zhao; +Cc: linux-wireless, linux-kernel

Hi

On Wed, Aug 20, 2025 at 04:58:43PM +0800, Xichao Zhao wrote:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.

There is this comment regarding dev_err_probe:

 * Using this helper in your probe function 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, which is emitted symbolically (i.e. you get "EAGAIN"
 * instead of "-35"), and having the error code returned allows more
 * compact error paths.

If you want this change you have please justify it better, i.e.
we don't need to print error message because ...

Regards
Stanislaw


> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> index 8f510a84e7f1..e5c99fc6509b 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> @@ -289,7 +289,7 @@ static int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops
>  
>  	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
>  	if (!hw)
> -		return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate hardware");
> +		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, hw);
>  
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-22  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20  8:58 [PATCH] wifi: rt2x00: Remove the use of dev_err_probe() Xichao Zhao
2025-08-22  7:44 ` Stanislaw Gruszka

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