[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211124190436.251312-1-makvihas@gmail.com>
Date: Thu, 25 Nov 2021 00:34:36 +0530
From: Vihas Mak <makvihas@...il.com>
To: Larry.Finger@...inger.net, phil@...lpotter.co.uk
Cc: gregkh@...uxfoundation.org, straube.linux@...il.com,
nathan@...nel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, Vihas Mak <makvihas@...il.com>
Subject: [PATCH v2] staging: r8188eu: use max() and min() macros
use max() and min() macros to fix following cocci warnings:
drivers/staging/r8188eu/core/rtw_wlan_util.c:719: WARNING opportunity for min()
drivers/staging/r8188eu/core/rtw_wlan_util.c:724: WARNING opportunity for max()
Signed-off-by: Vihas Mak <makvihas@...il.com>
---
v1 -> v2:
- fixed checkpatch issues (parenthesis alignment).
drivers/staging/r8188eu/core/rtw_wlan_util.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index 6d4e21a16783..524e8d22075c 100644
--- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
@@ -716,15 +716,11 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]);
} else {
/* modify from fw by Thomas 2010/11/17 */
- if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
- max_AMPDU_len = (pIE->data[i] & 0x3);
- else
- max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3);
-
- if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c))
- min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c);
- else
- min_MPDU_spacing = (pIE->data[i] & 0x1c);
+ max_AMPDU_len = min(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3,
+ pIE->data[i] & 0x3);
+
+ min_MPDU_spacing = max(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c,
+ pIE->data[i] & 0x1c);
pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para = max_AMPDU_len | min_MPDU_spacing;
}
--
2.25.1
Powered by blists - more mailing lists