Re: [PATCH v5 5/8] staging: rtl8723bs: rtw_mlme: extract local variables for long expressions

Luka Gejak
2026-04-28T13:26:13Z

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