public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Rene Hickersberger <renehickersberger@gmx.net>,
	gregkh@linuxfoundation.org
Cc: hadess@hadess.net, hdegoede@redhat.com,
	Larry.Finger@lwfinger.net, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: rtl8723bs: core: Fixed a brace coding style issue
Date: Sat, 06 May 2017 05:14:27 -0700	[thread overview]
Message-ID: <1494072867.31950.23.camel@perches.com> (raw)
In-Reply-To: <20170506120046.6186-1-renehickersberger@gmx.net>

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

      reply	other threads:[~2017-05-06 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=1494072867.31950.23.camel@perches.com \
    --to=joe@perches.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=renehickersberger@gmx.net \
    /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