Function hostif_data_indication_wpa() has various sites that can be
improved with whitespace refactoring. In particular checkpatch emits
WARNING: Avoid multiple line dereference. Also how long lines are
broken up may be modified to enhance readability. Checkpatch also
emits logical line continuation warnings. These can also be fixed
changing only whitespace.

Refactor code making whitespace only changes. Do not change the
program logic.

Signed-off-by: Tobin C. Harding <m...@tobin.cc>
---
 drivers/staging/ks7010/ks_hostif.c | 63 ++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 7ff5345..940ab64 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -308,7 +308,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct 
ap_info_t *ap_info,
 }
 
 static
-int hostif_data_indication_wpa(struct ks_wlan_private *priv, unsigned int 
auth_type)
+int hostif_data_indication_wpa(struct ks_wlan_private *priv,
+                              unsigned int auth_type)
 {
        struct ether_hdr *eth_hdr;
        unsigned short eth_proto;
@@ -319,7 +320,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private 
*priv, unsigned int auth_t
        struct mihcael_mic_t mihcael_mic;
        union iwreq_data wrqu;
        unsigned int key_index = auth_type - 1;
-       struct wpa_key_t *key = priv->wpa.key[key_index];
+       struct wpa_key_t *key = &priv->wpa.key[key_index];
 
        eth_hdr = (struct ether_hdr *)(priv->rxp);
        eth_proto = ntohs(eth_hdr->h_proto);
@@ -333,34 +334,32 @@ int hostif_data_indication_wpa(struct ks_wlan_private 
*priv, unsigned int auth_t
                priv->nstats.rx_errors++;
                return -EINVAL;
        }
-       if (((auth_type == TYPE_PMK1
-                               && priv->wpa.pairwise_suite ==
-                               IW_AUTH_CIPHER_TKIP) || (auth_type == TYPE_GMK1
-                                                       && priv->wpa.
-                                                       group_suite ==
-                                                       IW_AUTH_CIPHER_TKIP)
-                       || (auth_type == TYPE_GMK2
-                               && priv->wpa.group_suite ==
-                               IW_AUTH_CIPHER_TKIP))
-               && key.key_len) {
+       if (((auth_type == TYPE_PMK1 &&
+             priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) ||
+            (auth_type == TYPE_GMK1 &&
+             priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP) ||
+            (auth_type == TYPE_GMK2 &&
+             priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) &&
+           key->key_len) {
                DPRINTK(4, "TKIP: protocol=%04X: size=%u\n",
                        eth_proto, priv->rx_size);
                /* MIC save */
                memcpy(&recv_mic_buf[0],
-                       (priv->rxp) + ((priv->rx_size) - 8), 8);
+                      (priv->rxp) + ((priv->rx_size) - 8), 8);
                priv->rx_size = priv->rx_size - 8;
                if (auth_type > 0 && auth_type < 4) {   /* auth_type check */
-                       MichaelMICFunction(&mihcael_mic, (u8 *)key.rx_mic_key, 
(u8 *)priv->rxp, (int)priv->rx_size, (u8)0,      /* priority */
-                                       (u8 *)mihcael_mic.Result);
+                       MichaelMICFunction(&mihcael_mic,
+                                          (u8 *)key->rx_mic_key,
+                                          (u8 *)priv->rxp, (int)priv->rx_size,
+                                          (u8)0,       /* priority */
+                                          (u8 *)mihcael_mic.Result);
                }
                if (memcmp(mihcael_mic.Result, recv_mic_buf, 8)) {
                        now = jiffies;
                        mic_failure = &priv->wpa.mic_failure;
                        /* MIC FAILURE */
                        if (mic_failure->last_failure_time &&
-                               (now -
-                                       mic_failure->last_failure_time) /
-                               HZ >= 60) {
+                           (now - mic_failure->last_failure_time) / HZ >= 60) {
                                mic_failure->failure = 0;
                        }
                        DPRINTK(4, "MIC FAILURE\n");
@@ -370,31 +369,23 @@ int hostif_data_indication_wpa(struct ks_wlan_private 
*priv, unsigned int auth_t
                        } else if (mic_failure->failure == 1) {
                                mic_failure->failure = 2;
                                mic_failure->counter =
-                                       (u16)((now -
-                                                       mic_failure->
-                                                       last_failure_time)
-                                               / HZ);
+                                       (u16)((now - 
mic_failure->last_failure_time) / HZ);
                                if (!mic_failure->counter)      /* mic_failure 
counter value range 1-60 */
-                                       mic_failure->counter =
-                                               1;
+                                       mic_failure->counter = 1;
                        }
-                       priv->wpa.mic_failure.
-                               last_failure_time = now;
+                       priv->wpa.mic_failure.last_failure_time = now;
+
                        /*  needed parameters: count, keyid, key type, TSC */
                        sprintf(wrqu_buf,
-                               "MLME-MICHAELMICFAILURE.indication(keyid=%d 
%scast addr="
-                               "%pM)",
+                               "MLME-MICHAELMICFAILURE.indication(keyid=%d 
%scast addr=%pM)",
                                key_index,
-                               eth_hdr->
-                               h_dest[0] & 0x01 ? "broad" :
-                               "uni", eth_hdr->h_source);
+                               eth_hdr->h_dest[0] & 0x01 ? "broad" : "uni",
+                               eth_hdr->h_source);
                        memset(&wrqu, 0, sizeof(wrqu));
                        wrqu.data.length = strlen(wrqu_buf);
-                       DPRINTK(4,
-                               "IWEVENT:MICHAELMICFAILURE\n");
-                       wireless_send_event(priv->net_dev,
-                                       IWEVCUSTOM, &wrqu,
-                                       wrqu_buf);
+                       DPRINTK(4, "IWEVENT:MICHAELMICFAILURE\n");
+                       wireless_send_event(priv->net_dev, IWEVCUSTOM, &wrqu,
+                                           wrqu_buf);
                        return -EINVAL;
                }
        }
-- 
2.7.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to