* [PATCH] staging: r8188eu: use max() and min() macros
@ 2021-11-23 23:25 Vihas Mak
2021-11-24 13:14 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Vihas Mak @ 2021-11-23 23:25 UTC (permalink / raw)
To: Larry.Finger, phil
Cc: gregkh, straube.linux, nathan, linux-staging, linux-kernel, Vihas Mak
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@gmail.com>
---
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..d8fc54cc2389 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: r8188eu: use max() and min() macros
2021-11-23 23:25 [PATCH] staging: r8188eu: use max() and min() macros Vihas Mak
@ 2021-11-24 13:14 ` Dan Carpenter
2021-11-24 14:56 ` Vihas Mak
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-11-24 13:14 UTC (permalink / raw)
To: Vihas Mak
Cc: Larry.Finger, phil, gregkh, straube.linux, nathan, linux-staging,
linux-kernel
On Wed, Nov 24, 2021 at 04:55:51AM +0530, Vihas Mak wrote:
> +
> + min_MPDU_spacing = max(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c,
> + pIE->data[i] & 0x1c);
Please run scripts/checkpatch.pl on your patches.
CHECK: Alignment should match open parenthesis
#41: FILE: drivers/staging/r8188eu/core/rtw_wlan_util.c:723:
+ min_MPDU_spacing = max(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c,
+ pIE->data[i] & 0x1c);
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: r8188eu: use max() and min() macros
2021-11-24 13:14 ` Dan Carpenter
@ 2021-11-24 14:56 ` Vihas Mak
0 siblings, 0 replies; 3+ messages in thread
From: Vihas Mak @ 2021-11-24 14:56 UTC (permalink / raw)
To: Dan Carpenter
Cc: Larry.Finger, Phillip Potter, Greg KH, straube.linux, nathan,
linux-staging, linux-kernel
>> Please run scripts/checkpatch.pl on your patches.
>> CHECK: Alignment should match open parenthesis
>> #41: FILE: drivers/staging/r8188eu/core/rtw_wlan_util.c:723:
Ahh sorry, my bad. Will resend v2 after fixing that.
On Wed, Nov 24, 2021 at 6:44 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Wed, Nov 24, 2021 at 04:55:51AM +0530, Vihas Mak wrote:
>
> > +
> > + min_MPDU_spacing = max(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c,
> > + pIE->data[i] & 0x1c);
>
> Please run scripts/checkpatch.pl on your patches.
>
> CHECK: Alignment should match open parenthesis
> #41: FILE: drivers/staging/r8188eu/core/rtw_wlan_util.c:723:
> + min_MPDU_spacing = max(pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c,
> + pIE->data[i] & 0x1c);
>
> regards,
> dan carpenter
>
--
Thanks,
Vihas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-24 14:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 23:25 [PATCH] staging: r8188eu: use max() and min() macros Vihas Mak
2021-11-24 13:14 ` Dan Carpenter
2021-11-24 14:56 ` Vihas Mak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.