2018-03-14 12:45:17

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 0/7] Cleanup patches for wilc1000 driver

From: HariPrasath Elango <[email protected]>

This patchset has few cleanup patches related to coding guidelines and few
trivial changes

HariPrasath Elango (7):
staging: wilc1000: Fix code block alignment
staging: wilc1000: Destroy mutex object in deinitialization
staging: wilc1000: use kmemdup instead of kmalloc and memcpy
staging: wilc1000: destroy initialized mutex object
staging: wilc1000: replace switch statement by simple if condition
staging: wilc1000: remove unwanted braces and correct code alignment
staging: wilc1000: use kmemdup to replace kmalloc/memcpy

drivers/staging/wilc1000/host_interface.c | 27 +++++++++++++----------
drivers/staging/wilc1000/linux_mon.c | 3 +--
drivers/staging/wilc1000/linux_wlan.c | 7 +++---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++------
4 files changed, 22 insertions(+), 24 deletions(-)

--
2.10.0.GIT


2018-03-14 12:45:44

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition

From: HariPrasath Elango <[email protected]>

In this case,there is only a single switch case statement.So replacing
by a simple if condition.

Signed-off-by: HariPrasath Elango <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c901108..17bd762 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -772,14 +772,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
}

if (sme->crypto.n_akm_suites) {
- switch (sme->crypto.akm_suites[0]) {
- case WLAN_AKM_SUITE_8021X:
+ if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X)
auth_type = IEEE8021;
- break;
-
- default:
- break;
- }
}

curr_channel = pstrNetworkInfo->ch;
--
2.10.0.GIT

2018-03-19 18:45:47

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition

On Wed, Mar 14, 2018 at 06:15:03PM +0530, [email protected] wrote:
> From: HariPrasath Elango <[email protected]>
>
> In this case,there is only a single switch case statement.So replacing
> by a simple if condition.
>
> Signed-off-by: HariPrasath Elango <[email protected]>
> ---
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)

Does not apply to my tree :(

2018-03-14 12:45:34

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 3/7] staging: wilc1000: use kmemdup instead of kmalloc and memcpy

From: HariPrasath Elango <[email protected]>

Kmalloc followed by memcpy can be replaced by kmemdup.

Signed-off-by: HariPrasath Elango <[email protected]>
Reviewed-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_mon.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index f93f411..c6fd6b3 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -146,7 +146,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
if (!mgmt_tx)
return -ENOMEM;

- mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
+ mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC);
if (!mgmt_tx->buff) {
kfree(mgmt_tx);
return -ENOMEM;
@@ -154,7 +154,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)

mgmt_tx->size = len;

- memcpy(mgmt_tx->buff, buf, len);
wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
mgmt_tx_complete);

--
2.10.0.GIT

2018-03-14 12:45:55

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 7/7] staging: wilc1000: use kmemdup to replace kmalloc/memcpy

From: HariPrasath Elango <[email protected]>

kmalloc followed by memcpy can be replaced by kmemdup.Also added the
related error handling part

Signed-off-by: HariPrasath Elango <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0fac8e1..4ae2da6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -992,9 +992,13 @@ static s32 handle_connect(struct wilc_vif *vif,

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
info_element_size = hif_drv->usr_conn_req.ies_len;
- info_element = kmalloc(info_element_size, GFP_KERNEL);
- memcpy(info_element, hif_drv->usr_conn_req.ies,
- info_element_size);
+ info_element = kmemdup(hif_drv->usr_conn_req.ies,
+ info_element_size,
+ GFP_KERNEL);
+ if (!info_element) {
+ result = -ENOMEM;
+ goto ERRORHANDLER;
+ }
}

wid_list[wid_cnt].id = (u16)WID_11I_MODE;
--
2.10.0.GIT

2018-03-20 06:16:46

by <Hariprasath Elango>

[permalink] [raw]
Subject: Re: [PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition

On Mon, Mar 19, 2018 at 07:45:46PM +0100, Greg KH wrote:
> On Wed, Mar 14, 2018 at 06:15:03PM +0530, [email protected] wrote:
> > From: HariPrasath Elango <[email protected]>
> >
> > In this case,there is only a single switch case statement.So replacing
> > by a simple if condition.
> >
> > Signed-off-by: HariPrasath Elango <[email protected]>
> > ---
> > drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +-------
> > 1 file changed, 1 insertion(+), 7 deletions(-)
>
> Does not apply to my tree :(

Hi Greg,

Sorry about that. Shall I sent a v2 after rebasing my repo ? Will that
be fine ?

2018-03-16 10:06:19

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 7/7] staging: wilc1000: use kmemdup to replace kmalloc/memcpy

Hi HariPrasath,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20180309]
[cannot apply to v4.16-rc4 v4.16-rc3 v4.16-rc2 v4.16-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/hariprasath-elango-gmail-com/staging-wilc1000-Fix-code-block-alignment/20180316-104440


coccinelle warnings: (new ones prefixed by >>)

>> drivers/staging/wilc1000/host_interface.c:943:2-29: alloc with no test, possible model on line 995
drivers/staging/wilc1000/host_interface.c:949:2-28: alloc with no test, possible model on line 995
drivers/staging/wilc1000/host_interface.c:958:2-27: alloc with no test, possible model on line 995

vim +943 drivers/staging/wilc1000/host_interface.c

c5c77ba18 Johnny Kim 2015-05-11 917
e554a3055 Leo Kim 2015-11-19 918 u8 wilc_connected_ssid[6] = {0};
3ccff3322 Ajay Singh 2018-02-19 919 static s32 handle_connect(struct wilc_vif *vif,
120ae5938 Tony Cho 2015-09-21 920 struct connect_attr *pstrHostIFconnectAttr)
c5c77ba18 Johnny Kim 2015-05-11 921 {
31390eec7 Leo Kim 2015-10-19 922 s32 result = 0;
173508b82 Ajay Singh 2018-01-30 923 struct wid wid_list[8];
cdbdae15d Ajay Singh 2018-01-30 924 u32 wid_cnt = 0, dummyval = 0;
e33ff51ef Ajay Singh 2018-01-30 925 u8 *cur_byte = NULL;
24701563e Ajay Singh 2018-02-20 926 struct join_bss_param *bss_param;
71130e812 Glen Lee 2015-12-21 927 struct host_if_drv *hif_drv = vif->hif_drv;
c5c77ba18 Johnny Kim 2015-05-11 928
e554a3055 Leo Kim 2015-11-19 929 if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
31390eec7 Leo Kim 2015-10-19 930 result = 0;
b92f9304a Chris Park 2016-02-22 931 netdev_err(vif->ndev, "Discard connect request\n");
31390eec7 Leo Kim 2015-10-19 932 return result;
c5c77ba18 Johnny Kim 2015-05-11 933 }
c5c77ba18 Johnny Kim 2015-05-11 934
24701563e Ajay Singh 2018-02-20 935 bss_param = pstrHostIFconnectAttr->params;
24701563e Ajay Singh 2018-02-20 936 if (!bss_param) {
b92f9304a Chris Park 2016-02-22 937 netdev_err(vif->ndev, "Required BSSID not found\n");
31390eec7 Leo Kim 2015-10-19 938 result = -ENOENT;
24db713fe Leo Kim 2015-09-16 939 goto ERRORHANDLER;
c5c77ba18 Johnny Kim 2015-05-11 940 }
c5c77ba18 Johnny Kim 2015-05-11 941
91109e113 Leo Kim 2015-10-19 942 if (pstrHostIFconnectAttr->bssid) {
788f6fc08 Chaehyun Lim 2016-02-12 @943 hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
788f6fc08 Chaehyun Lim 2016-02-12 944 memcpy(hif_drv->usr_conn_req.bssid, pstrHostIFconnectAttr->bssid, 6);
c5c77ba18 Johnny Kim 2015-05-11 945 }
c5c77ba18 Johnny Kim 2015-05-11 946
74ab5e45e Leo Kim 2015-10-29 947 hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len;
91109e113 Leo Kim 2015-10-19 948 if (pstrHostIFconnectAttr->ssid) {
72216411b Chaehyun Lim 2016-02-12 949 hif_drv->usr_conn_req.ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
72216411b Chaehyun Lim 2016-02-12 950 memcpy(hif_drv->usr_conn_req.ssid,
8c8360b3f Leo Kim 2015-10-19 951 pstrHostIFconnectAttr->ssid,
8b3c9fa68 Leo Kim 2015-10-13 952 pstrHostIFconnectAttr->ssid_len);
72216411b Chaehyun Lim 2016-02-12 953 hif_drv->usr_conn_req.ssid[pstrHostIFconnectAttr->ssid_len] = '\0';
c5c77ba18 Johnny Kim 2015-05-11 954 }
c5c77ba18 Johnny Kim 2015-05-11 955
331ed0800 Leo Kim 2015-10-29 956 hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len;
91109e113 Leo Kim 2015-10-19 957 if (pstrHostIFconnectAttr->ies) {
a3b2f4b91 Leo Kim 2015-10-29 958 hif_drv->usr_conn_req.ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
a3b2f4b91 Leo Kim 2015-10-29 959 memcpy(hif_drv->usr_conn_req.ies,
8c8360b3f Leo Kim 2015-10-19 960 pstrHostIFconnectAttr->ies,
b59d5c5b5 Leo Kim 2015-10-13 961 pstrHostIFconnectAttr->ies_len);
c5c77ba18 Johnny Kim 2015-05-11 962 }
c5c77ba18 Johnny Kim 2015-05-11 963
a0942c579 Chaehyun Lim 2016-02-12 964 hif_drv->usr_conn_req.security = pstrHostIFconnectAttr->security;
7d0697282 Leo Kim 2015-10-29 965 hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type;
33bfb198f Leo Kim 2015-10-29 966 hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
73abaa490 Leo Kim 2015-10-29 967 hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;
c5c77ba18 Johnny Kim 2015-05-11 968
cdbdae15d Ajay Singh 2018-01-30 969 wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
cdbdae15d Ajay Singh 2018-01-30 970 wid_list[wid_cnt].type = WID_INT;
cdbdae15d Ajay Singh 2018-01-30 971 wid_list[wid_cnt].size = sizeof(u32);
cdbdae15d Ajay Singh 2018-01-30 972 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
cdbdae15d Ajay Singh 2018-01-30 973 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 974
cdbdae15d Ajay Singh 2018-01-30 975 wid_list[wid_cnt].id = WID_RECEIVED_FRAGMENT_COUNT;
cdbdae15d Ajay Singh 2018-01-30 976 wid_list[wid_cnt].type = WID_INT;
cdbdae15d Ajay Singh 2018-01-30 977 wid_list[wid_cnt].size = sizeof(u32);
cdbdae15d Ajay Singh 2018-01-30 978 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
cdbdae15d Ajay Singh 2018-01-30 979 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 980
cdbdae15d Ajay Singh 2018-01-30 981 wid_list[wid_cnt].id = WID_FAILED_COUNT;
cdbdae15d Ajay Singh 2018-01-30 982 wid_list[wid_cnt].type = WID_INT;
cdbdae15d Ajay Singh 2018-01-30 983 wid_list[wid_cnt].size = sizeof(u32);
cdbdae15d Ajay Singh 2018-01-30 984 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
cdbdae15d Ajay Singh 2018-01-30 985 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 986
cdbdae15d Ajay Singh 2018-01-30 987 wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
cdbdae15d Ajay Singh 2018-01-30 988 wid_list[wid_cnt].type = WID_BIN_DATA;
cdbdae15d Ajay Singh 2018-01-30 989 wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
cdbdae15d Ajay Singh 2018-01-30 990 wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
cdbdae15d Ajay Singh 2018-01-30 991 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 992
f7bbd9cf9 Leo Kim 2015-10-13 993 if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
331ed0800 Leo Kim 2015-10-29 994 info_element_size = hif_drv->usr_conn_req.ies_len;
8b38942e3 HariPrasath Elango 2018-03-14 @995 info_element = kmemdup(hif_drv->usr_conn_req.ies,
8b38942e3 HariPrasath Elango 2018-03-14 996 info_element_size,
8b38942e3 HariPrasath Elango 2018-03-14 997 GFP_KERNEL);
8b38942e3 HariPrasath Elango 2018-03-14 998 if (!info_element) {
8b38942e3 HariPrasath Elango 2018-03-14 999 result = -ENOMEM;
8b38942e3 HariPrasath Elango 2018-03-14 1000 goto ERRORHANDLER;
8b38942e3 HariPrasath Elango 2018-03-14 1001 }
c5c77ba18 Johnny Kim 2015-05-11 1002 }
06ea0cb65 HariPrasath Elango 2018-03-14 1003
cdbdae15d Ajay Singh 2018-01-30 1004 wid_list[wid_cnt].id = (u16)WID_11I_MODE;
cdbdae15d Ajay Singh 2018-01-30 1005 wid_list[wid_cnt].type = WID_CHAR;
cdbdae15d Ajay Singh 2018-01-30 1006 wid_list[wid_cnt].size = sizeof(char);
cdbdae15d Ajay Singh 2018-01-30 1007 wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
cdbdae15d Ajay Singh 2018-01-30 1008 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 1009
f7bbd9cf9 Leo Kim 2015-10-13 1010 if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
a0942c579 Chaehyun Lim 2016-02-12 1011 mode_11i = hif_drv->usr_conn_req.security;
c5c77ba18 Johnny Kim 2015-05-11 1012
cdbdae15d Ajay Singh 2018-01-30 1013 wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
cdbdae15d Ajay Singh 2018-01-30 1014 wid_list[wid_cnt].type = WID_CHAR;
cdbdae15d Ajay Singh 2018-01-30 1015 wid_list[wid_cnt].size = sizeof(char);
cdbdae15d Ajay Singh 2018-01-30 1016 wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
cdbdae15d Ajay Singh 2018-01-30 1017 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 1018
f7bbd9cf9 Leo Kim 2015-10-13 1019 if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
7d0697282 Leo Kim 2015-10-29 1020 auth_type = (u8)hif_drv->usr_conn_req.auth_type;
c5c77ba18 Johnny Kim 2015-05-11 1021
cdbdae15d Ajay Singh 2018-01-30 1022 wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
cdbdae15d Ajay Singh 2018-01-30 1023 wid_list[wid_cnt].type = WID_STR;
cdbdae15d Ajay Singh 2018-01-30 1024 wid_list[wid_cnt].size = 112;
cdbdae15d Ajay Singh 2018-01-30 1025 wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);
c5c77ba18 Johnny Kim 2015-05-11 1026
f7bbd9cf9 Leo Kim 2015-10-13 1027 if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
cdbdae15d Ajay Singh 2018-01-30 1028 join_req_size = wid_list[wid_cnt].size;
0626baaac Leo Kim 2015-10-15 1029 join_req = kmalloc(join_req_size, GFP_KERNEL);
c5c77ba18 Johnny Kim 2015-05-11 1030 }
cdbdae15d Ajay Singh 2018-01-30 1031 if (!wid_list[wid_cnt].val) {
31390eec7 Leo Kim 2015-10-19 1032 result = -EFAULT;
24db713fe Leo Kim 2015-09-16 1033 goto ERRORHANDLER;
24db713fe Leo Kim 2015-09-16 1034 }
c5c77ba18 Johnny Kim 2015-05-11 1035
e33ff51ef Ajay Singh 2018-01-30 1036 cur_byte = wid_list[wid_cnt].val;
c5c77ba18 Johnny Kim 2015-05-11 1037
91109e113 Leo Kim 2015-10-19 1038 if (pstrHostIFconnectAttr->ssid) {
e33ff51ef Ajay Singh 2018-01-30 1039 memcpy(cur_byte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
e33ff51ef Ajay Singh 2018-01-30 1040 cur_byte[pstrHostIFconnectAttr->ssid_len] = '\0';
c5c77ba18 Johnny Kim 2015-05-11 1041 }
e33ff51ef Ajay Singh 2018-01-30 1042 cur_byte += MAX_SSID_LEN;
e33ff51ef Ajay Singh 2018-01-30 1043 *(cur_byte++) = INFRASTRUCTURE;
ae4dfa572 Leo Kim 2015-10-13 1044
7bf0242a7 Ajay Singh 2018-01-22 1045 if (pstrHostIFconnectAttr->ch >= 1 && pstrHostIFconnectAttr->ch <= 14) {
e33ff51ef Ajay Singh 2018-01-30 1046 *(cur_byte++) = pstrHostIFconnectAttr->ch;
c5c77ba18 Johnny Kim 2015-05-11 1047 } else {
b92f9304a Chris Park 2016-02-22 1048 netdev_err(vif->ndev, "Channel out of range\n");
e33ff51ef Ajay Singh 2018-01-30 1049 *(cur_byte++) = 0xFF;
c5c77ba18 Johnny Kim 2015-05-11 1050 }
24701563e Ajay Singh 2018-02-20 1051 *(cur_byte++) = (bss_param->cap_info) & 0xFF;
24701563e Ajay Singh 2018-02-20 1052 *(cur_byte++) = ((bss_param->cap_info) >> 8) & 0xFF;
c5c77ba18 Johnny Kim 2015-05-11 1053
91109e113 Leo Kim 2015-10-19 1054 if (pstrHostIFconnectAttr->bssid)
e33ff51ef Ajay Singh 2018-01-30 1055 memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
e33ff51ef Ajay Singh 2018-01-30 1056 cur_byte += 6;
c5c77ba18 Johnny Kim 2015-05-11 1057
c0f52fbac Tony Cho 2015-10-20 1058 if (pstrHostIFconnectAttr->bssid)
e33ff51ef Ajay Singh 2018-01-30 1059 memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
e33ff51ef Ajay Singh 2018-01-30 1060 cur_byte += 6;
c0f52fbac Tony Cho 2015-10-20 1061
24701563e Ajay Singh 2018-02-20 1062 *(cur_byte++) = (bss_param->beacon_period) & 0xFF;
24701563e Ajay Singh 2018-02-20 1063 *(cur_byte++) = ((bss_param->beacon_period) >> 8) & 0xFF;
24701563e Ajay Singh 2018-02-20 1064 *(cur_byte++) = bss_param->dtim_period;
ae4dfa572 Leo Kim 2015-10-13 1065
24701563e Ajay Singh 2018-02-20 1066 memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1);
e33ff51ef Ajay Singh 2018-01-30 1067 cur_byte += (MAX_RATES_SUPPORTED + 1);
c5c77ba18 Johnny Kim 2015-05-11 1068
24701563e Ajay Singh 2018-02-20 1069 *(cur_byte++) = bss_param->wmm_cap;
24701563e Ajay Singh 2018-02-20 1070 *(cur_byte++) = bss_param->uapsd_cap;
c5c77ba18 Johnny Kim 2015-05-11 1071
24701563e Ajay Singh 2018-02-20 1072 *(cur_byte++) = bss_param->ht_capable;
24701563e Ajay Singh 2018-02-20 1073 hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable;
c5c77ba18 Johnny Kim 2015-05-11 1074
24701563e Ajay Singh 2018-02-20 1075 *(cur_byte++) = bss_param->rsn_found;
24701563e Ajay Singh 2018-02-20 1076 *(cur_byte++) = bss_param->rsn_grp_policy;
24701563e Ajay Singh 2018-02-20 1077 *(cur_byte++) = bss_param->mode_802_11i;
ae4dfa572 Leo Kim 2015-10-13 1078
24701563e Ajay Singh 2018-02-20 1079 memcpy(cur_byte, bss_param->rsn_pcip_policy, sizeof(bss_param->rsn_pcip_policy));
24701563e Ajay Singh 2018-02-20 1080 cur_byte += sizeof(bss_param->rsn_pcip_policy);
c5c77ba18 Johnny Kim 2015-05-11 1081
24701563e Ajay Singh 2018-02-20 1082 memcpy(cur_byte, bss_param->rsn_auth_policy, sizeof(bss_param->rsn_auth_policy));
24701563e Ajay Singh 2018-02-20 1083 cur_byte += sizeof(bss_param->rsn_auth_policy);
c5c77ba18 Johnny Kim 2015-05-11 1084
24701563e Ajay Singh 2018-02-20 1085 memcpy(cur_byte, bss_param->rsn_cap, sizeof(bss_param->rsn_cap));
24701563e Ajay Singh 2018-02-20 1086 cur_byte += sizeof(bss_param->rsn_cap);
c5c77ba18 Johnny Kim 2015-05-11 1087
e33ff51ef Ajay Singh 2018-01-30 1088 *(cur_byte++) = REAL_JOIN_REQ;
24701563e Ajay Singh 2018-02-20 1089 *(cur_byte++) = bss_param->noa_enabled;
c5c77ba18 Johnny Kim 2015-05-11 1090
24701563e Ajay Singh 2018-02-20 1091 if (bss_param->noa_enabled) {
24701563e Ajay Singh 2018-02-20 1092 *(cur_byte++) = (bss_param->tsf) & 0xFF;
24701563e Ajay Singh 2018-02-20 1093 *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF;
24701563e Ajay Singh 2018-02-20 1094 *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF;
24701563e Ajay Singh 2018-02-20 1095 *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF;
c5c77ba18 Johnny Kim 2015-05-11 1096
24701563e Ajay Singh 2018-02-20 1097 *(cur_byte++) = bss_param->opp_enabled;
24701563e Ajay Singh 2018-02-20 1098 *(cur_byte++) = bss_param->idx;
c5c77ba18 Johnny Kim 2015-05-11 1099
24701563e Ajay Singh 2018-02-20 1100 if (bss_param->opp_enabled)
24701563e Ajay Singh 2018-02-20 1101 *(cur_byte++) = bss_param->ct_window;
c5c77ba18 Johnny Kim 2015-05-11 1102
24701563e Ajay Singh 2018-02-20 1103 *(cur_byte++) = bss_param->cnt;
c5c77ba18 Johnny Kim 2015-05-11 1104
24701563e Ajay Singh 2018-02-20 1105 memcpy(cur_byte, bss_param->duration, sizeof(bss_param->duration));
24701563e Ajay Singh 2018-02-20 1106 cur_byte += sizeof(bss_param->duration);
c5c77ba18 Johnny Kim 2015-05-11 1107
24701563e Ajay Singh 2018-02-20 1108 memcpy(cur_byte, bss_param->interval, sizeof(bss_param->interval));
24701563e Ajay Singh 2018-02-20 1109 cur_byte += sizeof(bss_param->interval);
c5c77ba18 Johnny Kim 2015-05-11 1110
24701563e Ajay Singh 2018-02-20 1111 memcpy(cur_byte, bss_param->start_time, sizeof(bss_param->start_time));
24701563e Ajay Singh 2018-02-20 1112 cur_byte += sizeof(bss_param->start_time);
c4f97526a Chris Park 2016-02-04 1113 }
c5c77ba18 Johnny Kim 2015-05-11 1114
e33ff51ef Ajay Singh 2018-01-30 1115 cur_byte = wid_list[wid_cnt].val;
cdbdae15d Ajay Singh 2018-01-30 1116 wid_cnt++;
c5c77ba18 Johnny Kim 2015-05-11 1117
f7bbd9cf9 Leo Kim 2015-10-13 1118 if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
e33ff51ef Ajay Singh 2018-01-30 1119 memcpy(join_req, cur_byte, join_req_size);
7036c6244 Glen Lee 2015-12-21 1120 join_req_vif = vif;
c5c77ba18 Johnny Kim 2015-05-11 1121 }
c5c77ba18 Johnny Kim 2015-05-11 1122
e3f16965c Chris Park 2016-02-04 1123 if (pstrHostIFconnectAttr->bssid)
e554a3055 Leo Kim 2015-11-19 1124 memcpy(wilc_connected_ssid,
e554a3055 Leo Kim 2015-11-19 1125 pstrHostIFconnectAttr->bssid, ETH_ALEN);
c5c77ba18 Johnny Kim 2015-05-11 1126
173508b82 Ajay Singh 2018-01-30 1127 result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
cdbdae15d Ajay Singh 2018-01-30 1128 wid_cnt,
eb9939b76 Glen Lee 2015-12-21 1129 wilc_get_vif_idx(vif));
31390eec7 Leo Kim 2015-10-19 1130 if (result) {
b92f9304a Chris Park 2016-02-22 1131 netdev_err(vif->ndev, "failed to send config packet\n");
31390eec7 Leo Kim 2015-10-19 1132 result = -EFAULT;
24db713fe Leo Kim 2015-09-16 1133 goto ERRORHANDLER;
c5c77ba18 Johnny Kim 2015-05-11 1134 } else {
b60005a8c Leo Kim 2015-10-29 1135 hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
c5c77ba18 Johnny Kim 2015-05-11 1136 }
c5c77ba18 Johnny Kim 2015-05-11 1137
24db713fe Leo Kim 2015-09-16 1138 ERRORHANDLER:
31390eec7 Leo Kim 2015-10-19 1139 if (result) {
3b0437e18 Chaehyun Lim 2016-02-25 1140 struct connect_info strConnectInfo;
c5c77ba18 Johnny Kim 2015-05-11 1141
81a59506f Leo Kim 2015-10-29 1142 del_timer(&hif_drv->connect_timer);
c5c77ba18 Johnny Kim 2015-05-11 1143
3b0437e18 Chaehyun Lim 2016-02-25 1144 memset(&strConnectInfo, 0, sizeof(struct connect_info));
c5c77ba18 Johnny Kim 2015-05-11 1145
91109e113 Leo Kim 2015-10-19 1146 if (pstrHostIFconnectAttr->result) {
91109e113 Leo Kim 2015-10-19 1147 if (pstrHostIFconnectAttr->bssid)
d4a24e082 Chaehyun Lim 2016-02-25 1148 memcpy(strConnectInfo.bssid, pstrHostIFconnectAttr->bssid, 6);
c5c77ba18 Johnny Kim 2015-05-11 1149
91109e113 Leo Kim 2015-10-19 1150 if (pstrHostIFconnectAttr->ies) {
4607f9ccb Chaehyun Lim 2016-02-25 1151 strConnectInfo.req_ies_len = pstrHostIFconnectAttr->ies_len;
4ff485707 Chaehyun Lim 2016-02-25 1152 strConnectInfo.req_ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
4ff485707 Chaehyun Lim 2016-02-25 1153 memcpy(strConnectInfo.req_ies,
2ea158c47 Leo Kim 2015-10-13 1154 pstrHostIFconnectAttr->ies,
b59d5c5b5 Leo Kim 2015-10-13 1155 pstrHostIFconnectAttr->ies_len);
c5c77ba18 Johnny Kim 2015-05-11 1156 }
c5c77ba18 Johnny Kim 2015-05-11 1157
6abcc11db Leo Kim 2015-10-13 1158 pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP,
c5c77ba18 Johnny Kim 2015-05-11 1159 &strConnectInfo,
c5c77ba18 Johnny Kim 2015-05-11 1160 MAC_DISCONNECTED,
c5c77ba18 Johnny Kim 2015-05-11 1161 NULL,
8f38db897 Leo Kim 2015-10-13 1162 pstrHostIFconnectAttr->arg);
b60005a8c Leo Kim 2015-10-29 1163 hif_drv->hif_state = HOST_IF_IDLE;
4ff485707 Chaehyun Lim 2016-02-25 1164 kfree(strConnectInfo.req_ies);
4ff485707 Chaehyun Lim 2016-02-25 1165 strConnectInfo.req_ies = NULL;
c5c77ba18 Johnny Kim 2015-05-11 1166
c5c77ba18 Johnny Kim 2015-05-11 1167 } else {
b92f9304a Chris Park 2016-02-22 1168 netdev_err(vif->ndev, "Connect callback is NULL\n");
c5c77ba18 Johnny Kim 2015-05-11 1169 }
c5c77ba18 Johnny Kim 2015-05-11 1170 }
c5c77ba18 Johnny Kim 2015-05-11 1171
9254db077 Leo Kim 2015-10-13 1172 kfree(pstrHostIFconnectAttr->bssid);
9254db077 Leo Kim 2015-10-13 1173 pstrHostIFconnectAttr->bssid = NULL;
c5c77ba18 Johnny Kim 2015-05-11 1174
f7bbd9cf9 Leo Kim 2015-10-13 1175 kfree(pstrHostIFconnectAttr->ssid);
f7bbd9cf9 Leo Kim 2015-10-13 1176 pstrHostIFconnectAttr->ssid = NULL;
c5c77ba18 Johnny Kim 2015-05-11 1177
2ea158c47 Leo Kim 2015-10-13 1178 kfree(pstrHostIFconnectAttr->ies);
2ea158c47 Leo Kim 2015-10-13 1179 pstrHostIFconnectAttr->ies = NULL;
c5c77ba18 Johnny Kim 2015-05-11 1180
e33ff51ef Ajay Singh 2018-01-30 1181 kfree(cur_byte);
31390eec7 Leo Kim 2015-10-19 1182 return result;
c5c77ba18 Johnny Kim 2015-05-11 1183 }
c5c77ba18 Johnny Kim 2015-05-11 1184

:::::: The code at line 943 was first introduced by commit
:::::: 788f6fc0810f35add6077f1cfd40b7f030e955ba staging: wilc1000: rename pu8bssid in struct user_conn_req

:::::: TO: Chaehyun Lim <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

2018-03-20 11:30:14

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition

On Tue, Mar 20, 2018 at 11:42:27AM +0530, <Hariprasath Elango> wrote:
> On Mon, Mar 19, 2018 at 07:45:46PM +0100, Greg KH wrote:
> > On Wed, Mar 14, 2018 at 06:15:03PM +0530, [email protected] wrote:
> > > From: HariPrasath Elango <[email protected]>
> > >
> > > In this case,there is only a single switch case statement.So replacing
> > > by a simple if condition.
> > >
> > > Signed-off-by: HariPrasath Elango <[email protected]>
> > > ---
> > > drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +-------
> > > 1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > Does not apply to my tree :(
>
> Hi Greg,
>
> Sorry about that.

Probably there were other patches on the list that were applied first.
It's likely not your fault, but just part of the process.

> Shall I sent a v2 after rebasing my repo ? Will that
> be fine ?

Yes.

regards,
dan carpenter

2018-03-14 12:45:50

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 6/7] staging: wilc1000: remove unwanted braces and correct code alignment

From: HariPrasath Elango <[email protected]>

Remove the unwated brace and corrected the code block alignment
accordingly

Signed-off-by: HariPrasath Elango <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index a4ee175..0fac8e1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -984,20 +984,19 @@ static s32 handle_connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)(&(dummyval));
wid_cnt++;

- {
- wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
- wid_list[wid_cnt].type = WID_BIN_DATA;
- wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
- wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
- wid_cnt++;
-
- if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
- info_element_size = hif_drv->usr_conn_req.ies_len;
- info_element = kmalloc(info_element_size, GFP_KERNEL);
- memcpy(info_element, hif_drv->usr_conn_req.ies,
- info_element_size);
- }
+ wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
+ wid_list[wid_cnt].type = WID_BIN_DATA;
+ wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
+ wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
+ wid_cnt++;
+
+ if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ info_element_size = hif_drv->usr_conn_req.ies_len;
+ info_element = kmalloc(info_element_size, GFP_KERNEL);
+ memcpy(info_element, hif_drv->usr_conn_req.ies,
+ info_element_size);
}
+
wid_list[wid_cnt].id = (u16)WID_11I_MODE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
--
2.10.0.GIT

2018-03-20 11:42:31

by <Hariprasath Elango>

[permalink] [raw]
Subject: Re: [PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition

On Tue, Mar 20, 2018 at 02:29:51PM +0300, Dan Carpenter wrote:
> On Tue, Mar 20, 2018 at 11:42:27AM +0530, <Hariprasath Elango> wrote:
> > On Mon, Mar 19, 2018 at 07:45:46PM +0100, Greg KH wrote:
> > > On Wed, Mar 14, 2018 at 06:15:03PM +0530, [email protected] wrote:
> > > > From: HariPrasath Elango <[email protected]>
> > > >
> > > > In this case,there is only a single switch case statement.So replacing
> > > > by a simple if condition.
> > > >
> > > > Signed-off-by: HariPrasath Elango <[email protected]>
> > > > ---
> > > > drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +-------
> > > > 1 file changed, 1 insertion(+), 7 deletions(-)
> > >
> > > Does not apply to my tree :(
> >
> > Hi Greg,
> >
> > Sorry about that.
>
> Probably there were other patches on the list that were applied first.
> It's likely not your fault, but just part of the process.
>
> > Shall I sent a v2 after rebasing my repo ? Will that
> > be fine ?
>
> Yes.
>
> regards,
> dan carpenter

Hi dan,thanks for the feedback. I will send a new version of the patch

2018-03-14 14:08:12

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH 6/7] staging: wilc1000: remove unwanted braces and correct code alignment

On Wed, 14 Mar 2018 18:15:04 +0530
<[email protected]> wrote:

> From: HariPrasath Elango <[email protected]>
>
> Remove the unwated brace and corrected the code block alignment
> accordingly

Changes done in this patch are already taken care. Today, Greg has
applied the patch which had these changes. This patch can be ignore from
the patchset.


Regards,
Ajay

2018-03-14 12:45:39

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 4/7] staging: wilc1000: destroy initialized mutex object

From: HariPrasath Elango <[email protected]>

A mutex object that is initialized but not destroyed.This patch destroys
the mutex object

Signed-off-by: HariPrasath Elango <[email protected]>
---
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 205304c..c901108 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2303,6 +2303,7 @@ int wilc_deinit_host_int(struct net_device *net)

op_ifcs--;

+ mutex_destroy(&priv->scan_req_lock);
ret = wilc_deinit(vif);

clear_shadow_scan();
--
2.10.0.GIT

2018-03-14 12:45:22

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 1/7] staging: wilc1000: Fix code block alignment

From: HariPrasath Elango <[email protected]>

Fix the code alignment for a block of code to adhere to coding
guidelines

Signed-off-by: HariPrasath Elango <[email protected]>
Reviewed-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index fe19bf3..1af3c14 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -861,10 +861,10 @@ static int wilc_mac_open(struct net_device *ndev)
break;
}
}
- wilc_get_mac_address(vif, mac_add);
- netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
- memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);

+ wilc_get_mac_address(vif, mac_add);
+ netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
+ memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
memcpy(ndev->dev_addr, wl->vif[i]->src_addr, ETH_ALEN);

if (!is_valid_ether_addr(ndev->dev_addr)) {
--
2.10.0.GIT

2018-03-14 12:45:27

by <Hariprasath Elango>

[permalink] [raw]
Subject: [PATCH 2/7] staging: wilc1000: Destroy mutex object in deinitialization

From: HariPrasath Elango <[email protected]>

Destroy the mutex object that is initialized in wlan_init_locks()

Signed-off-by: HariPrasath Elango <[email protected]>
Reviewed-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/linux_wlan.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1af3c14..38a83bd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -678,6 +678,7 @@ static int wlan_deinit_locks(struct net_device *dev)

mutex_destroy(&wilc->hif_cs);
mutex_destroy(&wilc->rxq_cs);
+ mutex_destroy(&wilc->txq_add_to_head_cs);

return 0;
}
--
2.10.0.GIT