* [PATCH 2/7] staging: wilc1000: handle_set_mac_address: fix kmalloc return error code
2016-02-16 8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
@ 2016-02-16 8:39 ` Chaehyun Lim
2016-02-16 8:39 ` [PATCH 3/7] staging: wilc1000: handle_set_mac_address: use kmemdup Chaehyun Lim
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Chaehyun Lim @ 2016-02-16 8:39 UTC (permalink / raw)
To: gregkh
Cc: johnny.kim, austin.shin, chris.park, tony.cho, glen.lee, leo.kim,
linux-wireless, devel, Chaehyun Lim
This patch fix return error code of kmalloc as -ENOMEM instead of
-EFAULT.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 579b90a..4d50b38 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -432,7 +432,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
if (!mac_buf)
- return -EFAULT;
+ return -ENOMEM;
memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
--
2.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/7] staging: wilc1000: handle_set_mac_address: use kmemdup
2016-02-16 8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
2016-02-16 8:39 ` [PATCH 2/7] staging: wilc1000: handle_set_mac_address: fix kmalloc return error code Chaehyun Lim
@ 2016-02-16 8:39 ` Chaehyun Lim
2016-02-16 8:39 ` [PATCH 4/7] staging: wilc1000: handle_set_mac_address: change return type to void Chaehyun Lim
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Chaehyun Lim @ 2016-02-16 8:39 UTC (permalink / raw)
To: gregkh
Cc: johnny.kim, austin.shin, chris.park, tony.cho, glen.lee, leo.kim,
linux-wireless, devel, Chaehyun Lim
This patch replaces kmalloc followed by memcpy with kmemdup.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4d50b38..65d2393 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -429,13 +429,11 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
+ u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
if (!mac_buf)
return -ENOMEM;
- memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
-
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = mac_buf;
--
2.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/7] staging: wilc1000: handle_set_mac_address: change return type to void
2016-02-16 8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
2016-02-16 8:39 ` [PATCH 2/7] staging: wilc1000: handle_set_mac_address: fix kmalloc return error code Chaehyun Lim
2016-02-16 8:39 ` [PATCH 3/7] staging: wilc1000: handle_set_mac_address: use kmemdup Chaehyun Lim
@ 2016-02-16 8:39 ` Chaehyun Lim
2016-02-16 8:39 ` [PATCH 5/7] staging: wilc1000: handle_set_mac_address: change data type of result Chaehyun Lim
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Chaehyun Lim @ 2016-02-16 8:39 UTC (permalink / raw)
To: gregkh
Cc: johnny.kim, austin.shin, chris.park, tony.cho, glen.lee, leo.kim,
linux-wireless, devel, Chaehyun Lim
When handle_set_mac_address is called in hostIFthread that is a kernel
thread, it is not checked return type of this function. This patch
changes return type to void and removes a brace of if statement due to
have a single statement.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 65d2393..c671f05 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -424,15 +424,15 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
return result;
}
-static s32 handle_set_mac_address(struct wilc_vif *vif,
- struct set_mac_addr *set_mac_addr)
+static void handle_set_mac_address(struct wilc_vif *vif,
+ struct set_mac_addr *set_mac_addr)
{
s32 result = 0;
struct wid wid;
u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
if (!mac_buf)
- return -ENOMEM;
+ return;
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
@@ -441,13 +441,10 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
- if (result) {
+ if (result)
PRINT_ER("Failed to set mac address\n");
- result = -EFAULT;
- }
kfree(mac_buf);
- return result;
}
static s32 handle_get_mac_address(struct wilc_vif *vif,
--
2.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/7] staging: wilc1000: handle_set_mac_address: change data type of result
2016-02-16 8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
` (2 preceding siblings ...)
2016-02-16 8:39 ` [PATCH 4/7] staging: wilc1000: handle_set_mac_address: change return type to void Chaehyun Lim
@ 2016-02-16 8:39 ` Chaehyun Lim
2016-02-16 8:39 ` [PATCH 6/7] staging: wilc1000: handle_set_mac_address: rename result Chaehyun Lim
2016-02-16 8:39 ` [PATCH 7/7] staging: wilc1000: handle_set_mac_address: use netdev_err Chaehyun Lim
5 siblings, 0 replies; 7+ messages in thread
From: Chaehyun Lim @ 2016-02-16 8:39 UTC (permalink / raw)
To: gregkh
Cc: johnny.kim, austin.shin, chris.park, tony.cho, glen.lee, leo.kim,
linux-wireless, devel, Chaehyun Lim
result variable gets value from wilc_send_config_pkt that has return
value of int. This patch changes data type of result variable to int.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c671f05..90321a3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -427,7 +427,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
static void handle_set_mac_address(struct wilc_vif *vif,
struct set_mac_addr *set_mac_addr)
{
- s32 result = 0;
+ int result = 0;
struct wid wid;
u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
--
2.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/7] staging: wilc1000: handle_set_mac_address: rename result
2016-02-16 8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
` (3 preceding siblings ...)
2016-02-16 8:39 ` [PATCH 5/7] staging: wilc1000: handle_set_mac_address: change data type of result Chaehyun Lim
@ 2016-02-16 8:39 ` Chaehyun Lim
2016-02-16 8:39 ` [PATCH 7/7] staging: wilc1000: handle_set_mac_address: use netdev_err Chaehyun Lim
5 siblings, 0 replies; 7+ messages in thread
From: Chaehyun Lim @ 2016-02-16 8:39 UTC (permalink / raw)
To: gregkh
Cc: johnny.kim, austin.shin, chris.park, tony.cho, glen.lee, leo.kim,
linux-wireless, devel, Chaehyun Lim
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. It will be changed until all handle_*() function
has same variable name as ret.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 90321a3..bfca0b4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -427,7 +427,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
static void handle_set_mac_address(struct wilc_vif *vif,
struct set_mac_addr *set_mac_addr)
{
- int result = 0;
+ int ret = 0;
struct wid wid;
u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
@@ -439,9 +439,9 @@ static void handle_set_mac_address(struct wilc_vif *vif,
wid.val = mac_buf;
wid.size = ETH_ALEN;
- result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
- if (result)
+ ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+ wilc_get_vif_idx(vif));
+ if (ret)
PRINT_ER("Failed to set mac address\n");
kfree(mac_buf);
--
2.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 7/7] staging: wilc1000: handle_set_mac_address: use netdev_err
2016-02-16 8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
` (4 preceding siblings ...)
2016-02-16 8:39 ` [PATCH 6/7] staging: wilc1000: handle_set_mac_address: rename result Chaehyun Lim
@ 2016-02-16 8:39 ` Chaehyun Lim
5 siblings, 0 replies; 7+ messages in thread
From: Chaehyun Lim @ 2016-02-16 8:39 UTC (permalink / raw)
To: gregkh
Cc: johnny.kim, austin.shin, chris.park, tony.cho, glen.lee, leo.kim,
linux-wireless, devel, Chaehyun Lim
This patch uses netdev_err instead of PRINT_ER that is a custom debug
print.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
drivers/staging/wilc1000/host_interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index bfca0b4..d5859c5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -442,7 +442,7 @@ static void handle_set_mac_address(struct wilc_vif *vif,
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (ret)
- PRINT_ER("Failed to set mac address\n");
+ netdev_err(vif->ndev, "Failed to set mac address\n");
kfree(mac_buf);
}
--
2.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread