[PATCH 1/3] staging: rtl8192e: Avoid multiple line dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avoid multiple line dereference to make the code more readable, as
suggested by checkpatch.pl

This patch fixes the following checkpatch.pl warning:

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:189

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:195

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:204

- WARNING: Avoid multiple line dereference
    prefer 'priv->rtllib->swcamtable[4].key_buf[0]'
  FILE: ./rtl8192e/rtl8192e/rtl_cam.c:209

- WARNING: Avoid multiple line dereference
    prefer 'info_element->data[info_element->len]'
  FILE: ./rtl8192e/rtllib_rx.c:2287

Signed-off-by: Ojaswin Mujoo <ojaswin98@xxxxxxxxx>
---
These changes cause some of the lines to cross 80 characters however I
believe that they improve the readability and provide a good trade off.
Would love to hear your thoughts and suggestions on this.

 drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 12 ++++--------
 drivers/staging/rtl8192e/rtllib_rx.c        |  3 +--
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
index c8506517cc8d..f75a12543781 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
@@ -185,14 +185,12 @@ void rtl92e_cam_restore(struct net_device *dev)
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type,
 				       (u8 *)dev->dev_addr, 0,
-				       (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 		} else {
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type,
 				       MacAddr, 0,
-				       (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 		}
 
 	} else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP) {
@@ -200,13 +198,11 @@ void rtl92e_cam_restore(struct net_device *dev)
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type,
 				       (u8 *)dev->dev_addr, 0,
-				       (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 		} else {
 			rtl92e_set_key(dev, 4, 0,
 				       priv->rtllib->pairwise_key_type, MacAddr,
-				       0, (u32 *)(&priv->rtllib->swcamtable[4].
-				       key_buf[0]));
+				       0, (u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
 			}
 	}
 
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 15bbb63ca130..16931a4fae5d 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2283,8 +2283,7 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 
 		length -= sizeof(*info_element) + info_element->len;
 		info_element =
-		    (struct rtllib_info_element *)&info_element->
-		    data[info_element->len];
+		    (struct rtllib_info_element *)&info_element->data[info_element->len];
 	}
 
 	if (!network->atheros_cap_exist && !network->broadcom_cap_exist &&
-- 
2.25.1





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux