[PATCH 12/12] staging: ks7010: add intermediate variable

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

 



Function contains two sites where arithmetic expressions are used as
function argument. Readability would be increased if these were
factored out to a variable assignment then the variable used as
function argument.

Add variable and assign to it the result of arithmetic
expression. Replace complex function call with simplified call using
newly defined variable.

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks_hostif.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index d8c2abe..dcc04d0 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1127,6 +1127,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
 	struct ethhdr *eth;
 	int ret;
 	int no_key;
+	size_t size;
 
 	if (((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) ||
 	    (priv->connect_status & FORCE_DISCONNECT) ||
@@ -1154,9 +1155,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
 	}
 
 	DPRINTK(4, "skb_buff length=%d\n", skb_len);
-	pp = kmalloc(hif_align_size(sizeof(*pp) + ETH_ALEN + skb_len + MICHAEL_MIC_LEN),
-		     KS_WLAN_MEM_FLAG);
-
+	size = sizeof(*pp) + ETH_ALEN + skb_len + MICHAEL_MIC_LEN;
+	pp = kmalloc(hif_align_size(size), KS_WLAN_MEM_FLAG);
 	if (!pp) {
 		DPRINTK(3, "allocate memory failed..\n");
 		ret = -ENOMEM;
@@ -1255,9 +1255,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
 	}
 
 	/* header value set */
-	pp->header.size =
-	    cpu_to_le16((uint16_t)
-			(sizeof(*pp) - sizeof(pp->header.size) + skb_len));
+	size = sizeof(*pp) - sizeof(pp->header.size) + skb_len;
+	pp->header.size = cpu_to_le16((uint16_t)size);
 	pp->header.event = cpu_to_le16((uint16_t)HIF_DATA_REQ);
 
 	/* tx request */
-- 
2.7.4

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



[Index of Archives]     [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