netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Dongliang Mu <dzm91@hust.edu.cn>
Cc: Ping-Ke Shih <pkshih@realtek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Dongliang Mu <mudongliangabcd@gmail.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: rtlwifi: Use pr_warn_once instead of WARN_ONCE
Date: Tue, 10 May 2022 18:36:51 +0300	[thread overview]
Message-ID: <87ee118kmk.fsf@kernel.org> (raw)
In-Reply-To: <20220510092503.1546698-1-dzm91@hust.edu.cn> (Dongliang Mu's message of "Tue, 10 May 2022 17:25:03 +0800")

Dongliang Mu <dzm91@hust.edu.cn> writes:

> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> This memory allocation failure can be triggered by fault injection or
> high pressure testing, resulting a WARN.
>
> Fix this by replacing WARN with pr_warn_once.
>
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtlwifi/usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
> index 86a236873254..acb0c15e9748 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/usb.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
> @@ -1014,7 +1014,7 @@ int rtl_usb_probe(struct usb_interface *intf,
>  	hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) +
>  				sizeof(struct rtl_usb_priv), &rtl_ops);
>  	if (!hw) {
> -		WARN_ONCE(true, "rtl_usb: ieee80211 alloc failed\n");
> +		pr_warn_once("rtl_usb: ieee80211 alloc failed\n");
>  		return -ENOMEM;
>  	}
>  	rtlpriv = hw->priv;

I think we should warn every time ieee80211_alloc_hw() fails, it's
called only once per device initialisation, so pr_warn() is more
approriate.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2022-05-10 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  9:25 [PATCH] net: rtlwifi: Use pr_warn_once instead of WARN_ONCE Dongliang Mu
2022-05-10 15:36 ` Kalle Valo [this message]
2022-05-11  1:45   ` Dongliang Mu

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=87ee118kmk.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dzm91@hust.edu.cn \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mudongliangabcd@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pkshih@realtek.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;
as well as URLs for NNTP newsgroup(s).