[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD-N9QULVjecGcsmFGREGV=joyA2SoZFzLB9A-2tRPsVM0_Ohg@mail.gmail.com>
Date: Wed, 11 May 2022 09:45:40 +0800
From: Dongliang Mu <mudongliangabcd@...il.com>
To: Kalle Valo <kvalo@...nel.org>
Cc: Dongliang Mu <dzm91@...t.edu.cn>,
Ping-Ke Shih <pkshih@...ltek.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
linux-wireless@...r.kernel.org,
"open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: rtlwifi: Use pr_warn_once instead of WARN_ONCE
On Tue, May 10, 2022 at 11:37 PM Kalle Valo <kvalo@...nel.org> wrote:
>
> Dongliang Mu <dzm91@...t.edu.cn> writes:
>
> > From: Dongliang Mu <mudongliangabcd@...il.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@...il.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.
Yes, this is better. Already sent a v2 patch.
>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists