lkml.org 
[lkml]   [2017]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Staging: rtl8723bs: core: Fixed a brace coding style issue
From
Date
On Sat, 2017-05-06 at 14:00 +0200, Rene Hickersberger wrote:
> Fixed a brace coding style issue.
[]
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
[]
> @@ -863,11 +863,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
> auth = &psecuritypriv->authenticator_ie[0];
> psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength;
>
> - if ((psecnetwork->IELength-12) < (256-1)) {
> + if ((psecnetwork->IELength-12) < (256-1))
> memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12);
> - } else {
> + else
> memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1));
> - }

Because the first 2 arguments are very long and identical,
it's probably better to not use braces but use min() instead

memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12],
min(psecnetwork->IELength - 12, 256 - 1));

\
 
 \ /
  Last update: 2017-05-06 14:14    [W:0.924 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site