public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8723bs: core: Fixed a brace coding style issue
@ 2017-05-06 12:00 Rene Hickersberger
  2017-05-06 12:14 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Rene Hickersberger @ 2017-05-06 12:00 UTC (permalink / raw)
  To: gregkh
  Cc: hadess, hdegoede, Larry.Finger, devel, linux-kernel,
	Rene Hickersberger

Fixed a brace coding style issue.

Signed-off-by: Rene Hickersberger <renehickersberger@gmx.net>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 080c81b..ec2e569 100644
--- 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));
-	}
 
 	psecnetwork->IELength = 0;
 	/*  Added by Albert 2009/02/18 */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Staging: rtl8723bs: core: Fixed a brace coding style issue
  2017-05-06 12:00 [PATCH] Staging: rtl8723bs: core: Fixed a brace coding style issue Rene Hickersberger
@ 2017-05-06 12:14 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-05-06 12:14 UTC (permalink / raw)
  To: Rene Hickersberger, gregkh
  Cc: hadess, hdegoede, Larry.Finger, devel, linux-kernel

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));

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-06 12:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-06 12:00 [PATCH] Staging: rtl8723bs: core: Fixed a brace coding style issue Rene Hickersberger
2017-05-06 12:14 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox