mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Michael Straube <straube.linux@gmail.com>, gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] staging: rtl8188eu: cleanup indenting issue in mlme_linux.c
Date: Thu, 17 Jan 2019 11:44:30 -0800	[thread overview]
Message-ID: <174b4234659bfbb4f5a072f2928301da9cce67d8.camel@perches.com> (raw)
In-Reply-To: <20190117192301.17579-2-straube.linux@gmail.com>

On Thu, 2019-01-17 at 20:23 +0100, Michael Straube wrote:
> Cleanup indenting issue reported by checkpatch.
> CHECK: Alignment should match open parenthesis
[]
> diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
[]
> @@ -52,9 +52,8 @@ void rtw_reset_securitypriv(struct adapter *adapter)
>  		memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv));
>  
>  		/*  Restore the PMK information to securitypriv structure for the following connection. */
> -		memcpy(&adapter->securitypriv.PMKIDList[0],
> -			    &backup_pmkid[0],
> -			    sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
> +		memcpy(&adapter->securitypriv.PMKIDList[0], &backup_pmkid[0],
> +		       sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);

Hi.

Please try not to blindly follow checkpatch messages but
please do try to make the code more readable.

Just below this block is another block with a temporary
that uses &adapter->securitypriv.

How about hoisting the temporary and using that?

Something like:
---
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c | 32 +++++++++++++--------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index d5ceb3beabbc..320a0be2af3d 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -39,31 +39,31 @@ void rtw_reset_securitypriv(struct adapter *adapter)
 	u8	backup_index = 0;
 	u8	backup_counter = 0x00;
 	u32	backup_time = 0;
+	struct security_priv *psec_priv = &adapter->securitypriv;
 
-	if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) {
+	if (psec_priv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) {
 		/* 802.1x */
 		/*  We have to backup the PMK information for WiFi PMK Caching test item. */
 		/*  Backup the btkip_countermeasure information. */
 		/*  When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */
-		memcpy(&backup_pmkid[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
-		backup_index = adapter->securitypriv.PMKIDIndex;
-		backup_counter = adapter->securitypriv.btkip_countermeasure;
-		backup_time = adapter->securitypriv.btkip_countermeasure_time;
-		memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv));
+		memcpy(backup_pmkid, psec_priv->PMKIDList,
+		       sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
+		backup_index = psec_priv->PMKIDIndex;
+		backup_counter = psec_priv->btkip_countermeasure;
+		backup_time = psec_priv->btkip_countermeasure_time;
+
+		memset(psec_priv, 0, sizeof(*psec_priv));
 
 		/*  Restore the PMK information to securitypriv structure for the following connection. */
-		memcpy(&adapter->securitypriv.PMKIDList[0],
-			    &backup_pmkid[0],
-			    sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
-		adapter->securitypriv.PMKIDIndex = backup_index;
-		adapter->securitypriv.btkip_countermeasure = backup_counter;
-		adapter->securitypriv.btkip_countermeasure_time = backup_time;
-		adapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
-		adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
+		memcpy(psec_priv->PMKIDList, backup_pmkid,
+		       sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
+		psec_priv->PMKIDIndex = backup_index;
+		psec_priv->btkip_countermeasure = backup_counter;
+		psec_priv->btkip_countermeasure_time = backup_time;
+		psec_priv->ndisauthtype = Ndis802_11AuthModeOpen;
+		psec_priv->ndisencryptstatus = Ndis802_11WEPDisabled;
 	} else {
 		/* reset values in securitypriv */
-		struct security_priv *psec_priv = &adapter->securitypriv;
-
 		psec_priv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
 		psec_priv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
 		psec_priv->dot11PrivacyKeyIndex = 0;



  reply	other threads:[~2019-01-17 19:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 19:23 [PATCH 1/2] staging: rtl8188eu: add spaces around operators " Michael Straube
2019-01-17 19:23 ` [PATCH 2/2] staging: rtl8188eu: cleanup indenting issue " Michael Straube
2019-01-17 19:44   ` Joe Perches [this message]
2019-01-17 20:16     ` Michael Straube

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=174b4234659bfbb4f5a072f2928301da9cce67d8.camel@perches.com \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=straube.linux@gmail.com \
    /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

all inboxes | Powered by JetHome®