From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
"s.l-h@gmx.de" <s.l-h@gmx.de>,
"chewitt@libreelec.tv" <chewitt@libreelec.tv>
Subject: Re: [PATCH v2 00/12] wifi: rtlwifi: Add new rtl8192du driver
Date: Wed, 20 Mar 2024 15:57:24 +0200 [thread overview]
Message-ID: <75128dc9-402b-4904-8c00-15dee1537c6a@gmail.com> (raw)
In-Reply-To: <45b98bd53119455fa727d67640211fab@realtek.com>
On 20/03/2024 02:57, Ping-Ke Shih wrote:
>
>>> drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.h:60:39: warning: context imbalance in
>>> 'rtl92d_bandtype_2_4G' - unexpected unlock
>>> drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.h:60:39: warning: context imbalance in
>>> 'rtl92d_dm_false_alarm_counter_statistics' - unexpected unlock
>>> drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.h:60:39: warning: context imbalance in
>>> 'rtl92d_dm_cck_packet_detection_thresh' - unexpected unlock
>>
>> These look like false positives. Every unlock is preceded by
>> a lock. I found a suggestion to annotate the functions with
>> "__acquires(...)" and "__releases(...)" to quiet these warnings,
>> but that didn't do anything. I can only fix it by copying the
>> contents of rtl92d_acquire_cckandrw_pagea_ctl() and
>> rtl92d_release_cckandrw_pagea_ctl() to the eight places where
>> they are called, and duplicating the code that needs locking:
>>
>> if (rtlpriv->rtlhal.interfaceindex == 1 &&
>> rtlpriv->rtlhal.interface == INTF_PCI) {
>> spin_lock_irqsave(&rtlpriv->locks.cck_and_rw_pagea_lock, flag);
>> temp_cck = rtl_get_bbreg(hw, RCCK0_TXFILTER2,
>> MASKDWORD) & MASKCCK;
>> spin_unlock_irqrestore(&rtlpriv->locks.cck_and_rw_pagea_lock, flag);
>> } else {
>> temp_cck = rtl_get_bbreg(hw, RCCK0_TXFILTER2,
>> MASKDWORD) & MASKCCK;
>> }
>>
>
> Duplicate of main statements 'temp_cck = ....' isn't good. I prefer
>
> bool need_lock = rtlpriv->rtlhal.interfaceindex == 1 &&
> rtlpriv->rtlhal.interface == INTF_PCI;
>
> if (need_lock)
> spin_lock_irqsave(&rtlpriv->locks.cck_and_rw_pagea_lock, flag);
>
> temp_cck = rtl_get_bbreg(hw, RCCK0_TXFILTER2, MASKDWORD) & MASKCCK;
>
> if (need_lock)
> spin_unlock_irqrestore(&rtlpriv->locks.cck_and_rw_pagea_lock, flag);
>
Even this doesn't work. I get the same warning as before.
>
> But, I wonder why sparse doesn't complain original code (before your patchset)
> that used static inline already. Can we keep original style?
>
I found the reason. In patch 2/12 I moved the two functions
from rtl8192de/phy.h to rtl8192d/phy_common.h. This should be
harmless. But I also deleted these lines from the end of
rtl8192de/phy.h:
void rtl92d_acquire_cckandrw_pagea_ctl(struct ieee80211_hw *hw,
unsigned long *flag);
void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw,
unsigned long *flag);
They seemed pointless. If I add them to phy_common.h all the
warnings about locks go away. I will do this for v3.
prev parent reply other threads:[~2024-03-20 13:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-17 18:44 [PATCH v2 00/12] wifi: rtlwifi: Add new rtl8192du driver Bitterblue Smith
2024-03-17 18:45 ` [PATCH v2 01/12] wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power Bitterblue Smith
2024-03-17 18:46 ` [PATCH v2 02/12] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common Bitterblue Smith
2024-03-17 18:47 ` [PATCH v2 03/12] wifi: rtlwifi: Adjust rtl8192d-common for USB Bitterblue Smith
2024-03-17 18:48 ` [PATCH v2 04/12] wifi: rtlwifi: Add rtl8192du/table.{c,h} Bitterblue Smith
2024-03-17 18:49 ` [PATCH v2 05/12] wifi: rtlwifi: Add rtl8192du/hw.{c,h} Bitterblue Smith
2024-03-17 18:50 ` [PATCH v2 06/12] wifi: rtlwifi: Add rtl8192du/phy.{c,h} Bitterblue Smith
2024-03-17 18:51 ` [PATCH v2 07/12] wifi: rtlwifi: Add rtl8192du/trx.{c,h} Bitterblue Smith
2024-03-17 18:52 ` [PATCH v2 08/12] wifi: rtlwifi: Add rtl8192du/rf.{c,h} Bitterblue Smith
2024-03-17 18:53 ` [PATCH v2 09/12] wifi: rtlwifi: Add rtl8192du/fw.{c,h} and rtl8192du/led.{c,h} Bitterblue Smith
2024-03-17 18:54 ` [PATCH v2 10/12] wifi: rtlwifi: Add rtl8192du/dm.{c,h} Bitterblue Smith
2024-03-17 18:55 ` [PATCH v2 11/12] wifi: rtlwifi: Add rtl8192du/sw.{c,h} Bitterblue Smith
2024-03-19 8:08 ` Zenm Chen
2024-03-19 16:38 ` Bitterblue Smith
2024-03-17 18:57 ` [PATCH v2 12/12] wifi: rtlwifi: Enable the new rtl8192du driver Bitterblue Smith
2024-03-19 9:18 ` [PATCH v2 00/12] wifi: rtlwifi: Add " Ping-Ke Shih
2024-03-19 16:28 ` Bitterblue Smith
2024-03-20 0:57 ` Ping-Ke Shih
2024-03-20 13:57 ` Bitterblue Smith [this message]
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=75128dc9-402b-4904-8c00-15dee1537c6a@gmail.com \
--to=rtl8821cerfe2@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=chewitt@libreelec.tv \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=s.l-h@gmx.de \
/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