public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luka Gejak <luka.gejak@linux.dev>
To: Salman Alghamdi <me@cipherat.com>, gregkh@linuxfoundation.org
Cc: straube.linux@gmail.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org, luka.gejak@linux.dev
Subject: Re: [PATCH v5 5/8] staging: rtl8723bs: rtw_mlme: extract local variables for long expressions
Date: Tue, 28 Apr 2026 15:25:37 +0200	[thread overview]
Message-ID: <62E6BFE6-BACF-4791-A020-E7B98F5A27E0@linux.dev> (raw)
In-Reply-To: <20260428121737.435248-6-me@cipherat.com>

On April 28, 2026 2:15:48 PM GMT+02:00, Salman Alghamdi <me@cipherat.com> wrote:
>Extract local variables to shorten lines that cannot be wrapped
>cleanly.
>
>Signed-off-by: Salman Alghamdi <me@cipherat.com>
>---
> drivers/staging/rtl8723bs/core/rtw_mlme.c | 49 +++++++++++++++--------
> 1 file changed, 33 insertions(+), 16 deletions(-)
>
>diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
>index caaad38dd790..c7609f1a90f6 100644
>--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
>+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c

...

>@@ -650,7 +654,13 @@ static bool rtw_is_desired_network(struct adapter *adapter, struct wlan_network
> 		bselected = false;
> 
> 	if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
>-		if (pnetwork->network.infrastructure_mode != pmlmepriv->cur_network.network.infrastructure_mode)
>+		enum ndis_802_11_network_infrastructure inf_mode;
>+		enum ndis_802_11_network_infrastructure cur_inf;
>+
>+		inf_mode = pnetwork->network.infrastructure_mode;
>+		cur_inf = pmlmepriv->cur_network.network.infrastructure_mode;
>+
>+		if (inf_mode != cur_inf)
> 			bselected = false;
> 	}
> 
>@@ -735,9 +745,10 @@ void rtw_surveydone_event_callback(struct adapter	*adapter, u8 *pbuf)
> 				if (rtw_select_and_join_from_scanned_queue(pmlmepriv) == _SUCCESS) {
> 					_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
> 				} else {
>+					struct wlan_bssid_ex *pdev_network = &regs->dev_network;
>+					struct registry_priv *regs = &adapter->registrypriv;

I understand that you want to follow reverse christmas tree order as 
Dan requested, but you can't introduce compilation failures by doing 
that. Here, you are attempting to use regs to initialize pdev_network 
on the first line, but regs is not declared until the second line,
therefore this will fail to compile.

>+					u8 *pibss = regs->dev_network.mac_address;
> 					u8 ret = _SUCCESS;
>-					struct wlan_bssid_ex    *pdev_network = &adapter->registrypriv.dev_network;
>-					u8 *pibss = adapter->registrypriv.dev_network.mac_address;
> 
> 					/* pmlmepriv->fw_state ^= _FW_UNDER_SURVEY;
> 					 * because don't set assoc_timer
>@@ -792,8 +803,10 @@ void rtw_surveydone_event_callback(struct adapter	*adapter, u8 *pbuf)
> 			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
> 				&& check_fwstate(pmlmepriv, _FW_LINKED)) {
> 				if (rtw_select_roaming_candidate(pmlmepriv) == _SUCCESS) {
>-					receive_disconnect(adapter, pmlmepriv->cur_network.network.mac_address
>-						, WLAN_REASON_ACTIVE_ROAM);
>+					u8 *mac_addr = pmlmepriv->cur_network.network.mac_address;
>+
>+					receive_disconnect(adapter, mac_addr,
>+							   WLAN_REASON_ACTIVE_ROAM);

Thanks for fixing this :)

> 				}
> 			}
> 		}
>@@ -1069,8 +1082,9 @@ static void rtw_joinbss_update_network(struct adapter *padapter,
> 				       struct wlan_network *ptarget_wlan,
> 				       struct wlan_network  *pnetwork)
> {
>-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>+	u8 signal_strength = ptarget_wlan->network.phy_info.signal_strength;
> 	struct wlan_network  *cur_network = &pmlmepriv->cur_network;
>+	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

You have the exact same issue here, pmlmepriv is used to initialize 
cur_network before it is actually declared.

> 
> 	/*  why not use ptarget_wlan?? */
> 	memcpy(&cur_network->network, &pnetwork->network, pnetwork->network.length);

...

Please fix these errors, and ensure the code successfully compiles 
before sending v6.
Best regards,
Luka Gejak

  reply	other threads:[~2026-04-28 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 12:15 [PATCH v5 0/8] staging: rtl8723bs: rtw_mlme: fix long lines and related issues Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 1/8] staging: rtl8723bs: fix buffer over-read in rtw_update_protection Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 2/8] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 3/8] staging: rtl8723bs: rtw_mlme: wrap lines exceeding 100 columns Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 4/8] staging: rtl8723bs: rtw_mlme: wrap rtw_sitesurvey_cmd condition Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 5/8] staging: rtl8723bs: rtw_mlme: extract local variables for long expressions Salman Alghamdi
2026-04-28 13:25   ` Luka Gejak [this message]
2026-04-28 12:15 ` [PATCH v5 6/8] staging: rtl8723bs: rtw_mlme: remove dead commented-out code Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 7/8] staging: rtl8723bs: rtw_mlme: consolidate capability comparisons lines Salman Alghamdi
2026-04-28 12:15 ` [PATCH v5 8/8] staging: rtl8723bs: rtw_mlme: add blank line for readability Salman Alghamdi

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=62E6BFE6-BACF-4791-A020-E7B98F5A27E0@linux.dev \
    --to=luka.gejak@linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=me@cipherat.com \
    --cc=straube.linux@gmail.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