Skip to contentSkip to conversation

staging: wilc1000: fix return type of host_int_add_wep_key_bss_ap

PATCH New Chaehyun Lim 1 participant 10 messages Oct 27, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 staging: wilc1000: fix return type of host_int_add_wep_key_bss_ap

This patch changes return type of host_int_add_wep_key_bss_ap from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index 5a23738..e0a4cf3 100644
@@ -3191,14 +3191,14 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
 	return result;
 }
 
-s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 				const u8 *pu8WepKey,
 				u8 u8WepKeylen,
 				u8 u8Keyidx,
 				u8 u8mode,
 				enum AUTHTYPE tenuAuth_type)
 {
-	s32 result = 0;
+	int result = 0;
 	struct host_if_msg msg;
 	u8 i;
 
drivers/staging/wilc1000/host_interface.h +1 -1
index a9f7d1d..cd6199b 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#1 lore raw

PATCH 2/10 staging: wilc1000: fix parameter name of function declaration

This patch changes struct host_if_drv of host_int_add_wep_key_bss_ap function declaration from hWFIDrv to hif_drv.
With this change, first parameter name of this function declaration and definition has same name as hif_drv.

---
 drivers/staging/wilc1000/host_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.h +1 -1
index cd6199b..0bbbf4f 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#2 lore raw

PATCH 3/10 staging: wilc1000: replace u8 with int.

In reply to Chaehyun Lim

This patch changes data type of variable i from u8 to int. It is used as index of an array to print its content. It's better to use as data type of int.

---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.c +1 -1
index e0a4cf3..9a57d31a 100644
@@ -3200,7 +3200,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 {
 	int result = 0;
 	struct host_if_msg msg;
-	u8 i;
+	int i;
 
 	if (!hif_drv) {
 		PRINT_ER("driver is null\n");
Signature · 1 line
2.6.1
#3 lore raw

PATCH 4/10 staging: wilc1000: rename pu8WepKey in host_int_add_wep_key_bss_ap

In reply to Chaehyun Lim

This patch changes pu8WepKey to key that is second argument of this function to avoid camelcase.

---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/host_interface.c +3 -3
index 9a57d31a..4be42cb 100644
@@ -3192,7 +3192,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
 }
 
 int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
-				const u8 *pu8WepKey,
+				const u8 *key,
 				u8 u8WepKeylen,
 				u8 u8Keyidx,
 				u8 u8mode,
@@ -3211,14 +3211,14 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 
 	if (INFO) {
 		for (i = 0; i < u8WepKeylen; i++)
-			PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]);
+			PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", key[i]);
 	}
 	msg.id = HOST_IF_MSG_KEY;
 	msg.body.key_info.type = WEP;
 	msg.body.key_info.action = ADDKEY_AP;
 	msg.drv = hif_drv;
 	msg.body.key_info.attr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL);
-	memcpy(msg.body.key_info.attr.wep.key, pu8WepKey, (u8WepKeylen));
+	memcpy(msg.body.key_info.attr.wep.key, key, (u8WepKeylen));
 	msg.body.key_info.attr.wep.key_len = (u8WepKeylen);
 	msg.body.key_info.attr.wep.index = u8Keyidx;
 	msg.body.key_info.attr.wep.mode = u8mode;
drivers/staging/wilc1000/host_interface.h +1 -1
index 0bbbf4f..fa439f2 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#4 lore raw

PATCH 5/10 staging: wilc1000: rename u8WepKeylen in host_int_add_wep_key_bss_ap

In reply to Chaehyun Lim

This patch changes u8WepKeylen to len that is third argument of this function to avoid camelcase.

---
 drivers/staging/wilc1000/host_interface.c | 10 +++++-----
 drivers/staging/wilc1000/host_interface.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/host_interface.c +5 -5
index 4be42cb..c3cf7a1 100644
@@ -3193,7 +3193,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
 
 int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 				const u8 *key,
-				u8 u8WepKeylen,
+				u8 len,
 				u8 u8Keyidx,
 				u8 u8mode,
 				enum AUTHTYPE tenuAuth_type)
@@ -3210,16 +3210,16 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 	memset(&msg, 0, sizeof(struct host_if_msg));
 
 	if (INFO) {
-		for (i = 0; i < u8WepKeylen; i++)
+		for (i = 0; i < len; i++)
 			PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", key[i]);
 	}
 	msg.id = HOST_IF_MSG_KEY;
 	msg.body.key_info.type = WEP;
 	msg.body.key_info.action = ADDKEY_AP;
 	msg.drv = hif_drv;
-	msg.body.key_info.attr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL);
-	memcpy(msg.body.key_info.attr.wep.key, key, (u8WepKeylen));
-	msg.body.key_info.attr.wep.key_len = (u8WepKeylen);
+	msg.body.key_info.attr.wep.key = kmalloc(len, GFP_KERNEL);
+	memcpy(msg.body.key_info.attr.wep.key, key, len);
+	msg.body.key_info.attr.wep.key_len = len;
 	msg.body.key_info.attr.wep.index = u8Keyidx;
 	msg.body.key_info.attr.wep.mode = u8mode;
 	msg.body.key_info.attr.wep.auth_type = tenuAuth_type;
drivers/staging/wilc1000/host_interface.h +1 -1
index fa439f2..289dfd3 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#5 lore raw

PATCH 6/10 staging: wilc1000: rename u8Keyidx in host_int_add_wep_key_bss_ap

In reply to Chaehyun Lim

This patch changes u8Keyidx to index that is fourth argument of this function to avoid camelcase.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index c3cf7a1..c92e12a 100644
@@ -3194,7 +3194,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
 int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 				const u8 *key,
 				u8 len,
-				u8 u8Keyidx,
+				u8 index,
 				u8 u8mode,
 				enum AUTHTYPE tenuAuth_type)
 {
@@ -3220,7 +3220,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 	msg.body.key_info.attr.wep.key = kmalloc(len, GFP_KERNEL);
 	memcpy(msg.body.key_info.attr.wep.key, key, len);
 	msg.body.key_info.attr.wep.key_len = len;
-	msg.body.key_info.attr.wep.index = u8Keyidx;
+	msg.body.key_info.attr.wep.index = index;
 	msg.body.key_info.attr.wep.mode = u8mode;
 	msg.body.key_info.attr.wep.auth_type = tenuAuth_type;
 
drivers/staging/wilc1000/host_interface.h +1 -1
index 289dfd3..ab88ed5 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 u8mode, enum AUTHTYPE tenuAuth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#6 lore raw

PATCH 7/10 staging: wilc1000: rename u8mode in host_int_add_wep_key_bss_ap

In reply to Chaehyun Lim

This patch changes u8mode to mode that is fifth argument of this function to avoid camelcase.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index c92e12a..fbafed9 100644
@@ -3195,7 +3195,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 				const u8 *key,
 				u8 len,
 				u8 index,
-				u8 u8mode,
+				u8 mode,
 				enum AUTHTYPE tenuAuth_type)
 {
 	int result = 0;
@@ -3221,7 +3221,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 	memcpy(msg.body.key_info.attr.wep.key, key, len);
 	msg.body.key_info.attr.wep.key_len = len;
 	msg.body.key_info.attr.wep.index = index;
-	msg.body.key_info.attr.wep.mode = u8mode;
+	msg.body.key_info.attr.wep.mode = mode;
 	msg.body.key_info.attr.wep.auth_type = tenuAuth_type;
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
drivers/staging/wilc1000/host_interface.h +1 -1
index ab88ed5..1927d4c 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 u8mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE tenuAuth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#7 lore raw

PATCH 8/10 staging: wilc1000: rename tenuAuth_type in host_int_add_wep_key_bss_ap

In reply to Chaehyun Lim

This patch changes tenuAuth_type to auth_type that is sixth argument of this function to avoid camelcase.

---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/host_interface.c +2 -2
index fbafed9..2f4f699 100644
@@ -3196,7 +3196,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 				u8 len,
 				u8 index,
 				u8 mode,
-				enum AUTHTYPE tenuAuth_type)
+				enum AUTHTYPE auth_type)
 {
 	int result = 0;
 	struct host_if_msg msg;
@@ -3222,7 +3222,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 	msg.body.key_info.attr.wep.key_len = len;
 	msg.body.key_info.attr.wep.index = index;
 	msg.body.key_info.attr.wep.mode = mode;
-	msg.body.key_info.attr.wep.auth_type = tenuAuth_type;
+	msg.body.key_info.attr.wep.auth_type = auth_type;
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
 
drivers/staging/wilc1000/host_interface.h +1 -1
index 1927d4c..cae61a4 100644
@@ -421,7 +421,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE tenuAuth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1
#8 lore raw

PATCH 9/10 staging: wilc1000: replace kmalloc/memcpy with kmemdup

In reply to Chaehyun Lim

This patch replaces kmalloc followed by memcpy with kmemdup. It is also added error checking to return -ENOMEM when kmemdup is failed.

---
 drivers/staging/wilc1000/host_interface.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/host_interface.c +4 -2
index 2f4f699..0b70ada 100644
@@ -3217,8 +3217,10 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
 	msg.body.key_info.type = WEP;
 	msg.body.key_info.action = ADDKEY_AP;
 	msg.drv = hif_drv;
-	msg.body.key_info.attr.wep.key = kmalloc(len, GFP_KERNEL);
-	memcpy(msg.body.key_info.attr.wep.key, key, len);
+	msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
+	if (!msg.body.key_info.attr.wep.key)
+		return -ENOMEM;
+
 	msg.body.key_info.attr.wep.key_len = len;
 	msg.body.key_info.attr.wep.index = index;
 	msg.body.key_info.attr.wep.mode = mode;
Signature · 1 line
2.6.1
#9 lore raw

PATCH 10/10 staging: wilc1000: fix line over 80 characters

In reply to Chaehyun Lim

This patch fixes line over 80 characters found by checkpatch.

WARNING: line over 80 characters
FILE: drivers/staging/wilc1000/host_interface.h:424:

---
 drivers/staging/wilc1000/host_interface.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/wilc1000/host_interface.h +3 -1
index cae61a4..7b8b1c6 100644
@@ -421,7 +421,9 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
  *  @date		28 Feb 2013
  *  @version		1.0
  */
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type);
+int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+				const u8 *key, u8 len, u8 index, u8 mode,
+				enum AUTHTYPE auth_type);
 
 /**
  *  @brief              adds ptk Key
Signature · 1 line
2.6.1