From: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
To: outreachy@lists.linux.dev
Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, julia.lawall@inria.fr,
Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
Subject: [PATCH 4/5] staging: rtl8723bs: correct placement of braces around if-else block
Date: Fri, 28 Mar 2025 13:39:41 +0100 [thread overview]
Message-ID: <a7938a2ba84f1347518f80c68b41d1b03cf4acf5.1743163801.git.abrahamadekunle50@gmail.com> (raw)
In-Reply-To: <cover.1743163800.git.abrahamadekunle50@gmail.com>
The if-else blocks includes cases where braces were used for multiple
statement 'if' blocks and no braces for corresponding single statement
'else' blocks and vice versa.
It also includes case where for both single statement
'if' and 'else' blocks use braces defying Linux kernel coding style.
Modify if-else blocks where multiple statement 'if' blocks use braces
and corresponding single 'else' block use no braces and vice versa to all
use braces and removing braces for single statement if and else blocks
to conform to Linux kernel coding style.
Reported by checkpatch:
Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +--
.../staging/rtl8723bs/core/rtw_ieee80211.c | 9 +++--
drivers/staging/rtl8723bs/core/rtw_mlme.c | 13 +++----
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 11 +++---
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 7 ++--
drivers/staging/rtl8723bs/core/rtw_recv.c | 36 +++++++++----------
drivers/staging/rtl8723bs/core/rtw_xmit.c | 8 ++---
7 files changed, 47 insertions(+), 41 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 7820cb17eecc..ad949b0e2b97 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -273,9 +273,9 @@ struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)
/* spin_lock_bh(&(queue->lock)); */
spin_lock_irqsave(&queue->lock, irqL);
- if (list_empty(&queue->queue))
+ if (list_empty(&queue->queue)) {
obj = NULL;
- else {
+ } else {
obj = container_of(get_next(&queue->queue), struct cmd_obj, list);
list_del_init(&obj->list);
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e0b1c1a1311b..643fc11021a2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -466,8 +466,9 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
pos += WPA_SELECTOR_LEN;
left -= WPA_SELECTOR_LEN;
- } else if (left > 0)
+ } else if (left > 0) {
return _FAIL;
+ }
/* pairwise_cipher */
if (left >= 2) {
@@ -526,8 +527,9 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
pos += RSN_SELECTOR_LEN;
left -= RSN_SELECTOR_LEN;
- } else if (left > 0)
+ } else if (left > 0) {
return _FAIL;
+ }
/* pairwise_cipher */
if (left >= 2) {
@@ -546,8 +548,9 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
left -= RSN_SELECTOR_LEN;
}
- } else if (left == 1)
+ } else if (left == 1) {
return _FAIL;
+ }
if (is_8021x) {
if (left >= 6) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index a0cadb1d8a49..193999a6a00f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -739,9 +739,9 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
} else {
pmlmepriv->to_join = true;
}
- } else
+ } else {
rtw_indicate_disconnect(adapter);
-
+ }
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
}
}
@@ -1523,15 +1523,16 @@ void rtw_mlme_reset_auto_scan_int(struct adapter *adapter)
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- if (pmlmeinfo->VHT_enable) /* disable auto scan when connect to 11AC AP */
+ if (pmlmeinfo->VHT_enable) { /* disable auto scan when connect to 11AC AP */
mlme->auto_scan_int_ms = 0;
- else if (adapter->registrypriv.wifi_spec && is_client_associated_to_ap(adapter) == true)
+ } else if (adapter->registrypriv.wifi_spec && is_client_associated_to_ap(adapter) == true) {
mlme->auto_scan_int_ms = 60 * 1000;
- else if (rtw_chk_roam_flags(adapter, RTW_ROAM_ACTIVE)) {
+ } else if (rtw_chk_roam_flags(adapter, RTW_ROAM_ACTIVE)) {
if (check_fwstate(mlme, WIFI_STATION_STATE) && check_fwstate(mlme, _FW_LINKED))
mlme->auto_scan_int_ms = mlme->roam_scan_int_ms;
- } else
+ } else {
mlme->auto_scan_int_ms = 0; /* disabled */
+ }
}
static void rtw_auto_scan_handler(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 667337793385..183c3046ca1f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -2945,9 +2945,9 @@ void issue_assocreq(struct adapter *padapter)
if (bssrate_len > 8) {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &(pattrib->pktlen));
pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
- } else
+ } else {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &(pattrib->pktlen));
-
+ }
/* vendor specific IE, such as WPA, WMM, WPS */
for (i = sizeof(struct ndis_802_11_fix_ie); i < pmlmeinfo->network.ie_length;) {
pIE = (struct ndis_80211_var_ie *)(pmlmeinfo->network.ies + i);
@@ -3974,9 +3974,9 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
memcpy(bssid->ssid.ssid, (p + 2), *(p + 1));
bssid->ssid.ssid_length = *(p + 1);
- } else
+ } else {
bssid->ssid.ssid_length = 0;
-
+ }
memset(bssid->supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
/* checking rate info... */
@@ -4056,8 +4056,9 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
if (le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & BIT(14))
pmlmepriv->num_FortyMHzIntolerant++;
- } else
+ } else {
pmlmepriv->num_sta_no_ht++;
+ }
}
/* mark bss info receiving from nearby channel as signal_quality 101 */
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 74a8fcf18e84..84109e338c86 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -462,8 +462,9 @@ void LPS_Enter(struct adapter *padapter, const char *msg)
pwrpriv->bpower_saving = true;
rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, padapter->registrypriv.smart_ps, 0, buf);
}
- } else
+ } else {
pwrpriv->LpsIdleCount++;
+ }
}
}
@@ -1098,9 +1099,9 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode)
pwrctrlpriv->bLeisurePs =
pwrctrlpriv->power_mgnt != PS_MODE_ACTIVE;
}
- } else
+ } else {
ret = -EINVAL;
-
+ }
return ret;
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index f1d17a1dc8fb..479596f17a8d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -109,9 +109,9 @@ union recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
struct adapter *padapter;
struct recv_priv *precvpriv;
- if (list_empty(&pfree_recv_queue->queue))
+ if (list_empty(&pfree_recv_queue->queue)) {
precvframe = NULL;
- else {
+ } else {
phead = get_list_head(pfree_recv_queue);
plist = get_next(phead);
@@ -275,9 +275,9 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue)
spin_lock_bh(&queue->lock);
- if (list_empty(&queue->queue))
+ if (list_empty(&queue->queue)) {
precvbuf = NULL;
- else {
+ } else {
phead = get_list_head(queue);
plist = get_next(phead);
@@ -432,9 +432,9 @@ static union recv_frame *decryptor(struct adapter *padapter, union recv_frame *p
if (res == _FAIL) {
rtw_free_recvframe(return_packet, &padapter->recvpriv.free_recv_queue);
return_packet = NULL;
- } else
+ } else {
prxattrib->bdecrypted = true;
-
+ }
return return_packet;
}
@@ -479,9 +479,9 @@ static union recv_frame *portctrl(struct adapter *adapter, union recv_frame *pre
memcpy(&be_tmp, ptr, 2);
ether_type = ntohs(be_tmp);
- if (ether_type == eapol_type)
+ if (ether_type == eapol_type) {
prtnframe = precv_frame;
- else {
+ } else {
/* free this frame */
rtw_free_recvframe(precv_frame, &adapter->recvpriv.free_recv_queue);
prtnframe = NULL;
@@ -500,9 +500,9 @@ static union recv_frame *portctrl(struct adapter *adapter, union recv_frame *pre
/* else { */
/* */
}
- } else
+ } else {
prtnframe = precv_frame;
-
+ }
return prtnframe;
}
@@ -711,9 +711,9 @@ static signed int sta2sta_data_frame(struct adapter *adapter, union recv_frame *
memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
sta_addr = mybssid;
- } else
+ } else {
ret = _FAIL;
-
+ }
if (bmcast)
@@ -1121,11 +1121,12 @@ static union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union re
if (type != WIFI_DATA_TYPE) {
psta = rtw_get_bcmc_stainfo(padapter);
pdefrag_q = &psta->sta_recvpriv.defrag_q;
- } else
+ } else {
pdefrag_q = NULL;
- } else
+ }
+ } else {
pdefrag_q = &psta->sta_recvpriv.defrag_q;
-
+ }
if ((ismfrag == 0) && (fragnum == 0))
prtnframe = precv_frame;/* isn't a fragment frame */
@@ -1281,11 +1282,10 @@ static signed int validate_recv_data_frame(struct adapter *adapter, union recv_f
}
- if (ret == _FAIL) {
+ if (ret == _FAIL)
goto exit;
- } else if (ret == RTW_RX_HANDLED) {
+ else if (ret == RTW_RX_HANDLED)
goto exit;
- }
if (!psta) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 297c93d65315..026061b464f7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -2001,12 +2001,12 @@ inline bool xmitframe_hiq_filter(struct xmit_frame *xmitframe)
)
allow = true;
- } else if (registry->hiq_filter == RTW_HIQ_FILTER_ALLOW_ALL)
+ } else if (registry->hiq_filter == RTW_HIQ_FILTER_ALLOW_ALL) {
allow = true;
- else if (registry->hiq_filter == RTW_HIQ_FILTER_DENY_ALL) {
- } else
+ } else if (registry->hiq_filter == RTW_HIQ_FILTER_DENY_ALL) {
+ } else {
rtw_warn_on(1);
-
+ }
return allow;
}
--
2.34.1
next prev parent reply other threads:[~2025-03-28 12:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 12:39 [PATCH 0/5] staging: rtl8723bs: code cleanup patches Abraham Samuel Adekunle
2025-03-28 12:39 ` [PATCH 1/5] staging: rtl8723bs: correct coding style by preventing lines from ending with '(' Abraham Samuel Adekunle
2025-03-28 12:39 ` [PATCH 2/5] staging: rtl8723bs: align function return type and name on the same line Abraham Samuel Adekunle
2025-03-28 12:39 ` [PATCH 3/5] staging: rtl8723bs: add spaces around binary and ternary operators Abraham Samuel Adekunle
2025-03-28 12:39 ` Abraham Samuel Adekunle [this message]
2025-03-28 12:39 ` [PATCH 5/5] staging: rtl8723bs: modify variable names to comply with kernel naming convention Abraham Samuel Adekunle
2025-03-28 14:55 ` Julia Lawall
2025-03-28 15:08 ` Samuel Abraham
2025-03-28 15:13 ` Julia Lawall
2025-03-28 15:17 ` Samuel Abraham
2025-04-03 2:35 ` kernel test robot
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=a7938a2ba84f1347518f80c68b41d1b03cf4acf5.1743163801.git.abrahamadekunle50@gmail.com \
--to=abrahamadekunle50@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
/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
all inboxes | Powered by JetHome®