2018-01-22 10:22:53

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase

This patch series contains changes to fix issues reported by checkpatch.pl script.

Changes since v1:
* Patch0004: Used "host_int_parse_join_bss_param" for function name.
* Patch0009: Put memcpy statement in single line instead of using two lines.
* Patch0010: Used "bss_param" for variable name instead of j_bss_param.
* Added "Reviewed-by: Claudiu Beznea <[email protected]>" for commit description.
* Modify the commit description to start with capital letter for all patch.


Ajay Singh (14):
staging: wilc1000: remove unnecessary use of parentheses
staging: wilc1000: removed unnecessary defined enums typedef
staging: wilc1000: fix alignments to match open parenthesis
staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
variable using camelCase
staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
variable
staging: wilc1000: rename strWIDList variable to wid_list to avoid
camelCase
staging: wilc1000: rename u32WidsCount variable to avoid camelCase
staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
camelCase
staging: wilc1000: rename ptstrJoinBssParam variable to avoid
camelCase
staging: wilc1000: rename strConnectInfo variable to avoid camelCase
staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
staging: wilc1000: rename Handle_Connect() to avoid camelCase
staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()

drivers/staging/wilc1000/coreconfigurator.c | 2 +-
drivers/staging/wilc1000/host_interface.c | 937 +++++++++++-----------
drivers/staging/wilc1000/linux_wlan.c | 10 +-
drivers/staging/wilc1000/wilc_sdio.c | 4 +-
drivers/staging/wilc1000/wilc_spi.c | 20 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 64 +-
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
drivers/staging/wilc1000/wilc_wlan_if.h | 72 +-
9 files changed, 555 insertions(+), 562 deletions(-)

--
2.7.4


2018-01-22 11:08:21

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase



On 22.01.2018 12:22, Ajay Singh wrote:
> Fix "Avoid camelcase" issue found by checkpatch.pl
> script.
>
Same here as in patch 02 of this series.

> Signed-off-by: Ajay Singh <[email protected]>
> Reviewed-by: Claudiu Beznea <[email protected]>
> ---
> drivers/staging/wilc1000/host_interface.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index b34243c..6e462db 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -902,7 +902,7 @@ static s32 handle_scan_done(struct wilc_vif *vif,
> }
>
> u8 wilc_connected_ssid[6] = {0};
> -static s32 Handle_Connect(struct wilc_vif *vif,
> +static s32 handle_connect(struct wilc_vif *vif,
> struct connect_attr *attr)
> {
> s32 result = 0;
> @@ -2491,7 +2491,7 @@ static void host_if_work(struct work_struct *work)
> break;
>
> case HOST_IF_MSG_CONNECT:
> - Handle_Connect(msg->vif, &msg->body.con_info);
> + handle_connect(msg->vif, &msg->body.con_info);
> break;
>
> case HOST_IF_MSG_RCVD_NTWRK_INFO:
>

2018-01-22 10:23:34

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

Fix "Avoid camelcase" issue found by checkpatch.pl
script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index b34243c..6e462db 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -902,7 +902,7 @@ static s32 handle_scan_done(struct wilc_vif *vif,
}

u8 wilc_connected_ssid[6] = {0};
-static s32 Handle_Connect(struct wilc_vif *vif,
+static s32 handle_connect(struct wilc_vif *vif,
struct connect_attr *attr)
{
s32 result = 0;
@@ -2491,7 +2491,7 @@ static void host_if_work(struct work_struct *work)
break;

case HOST_IF_MSG_CONNECT:
- Handle_Connect(msg->vif, &msg->body.con_info);
+ handle_connect(msg->vif, &msg->body.con_info);
break;

case HOST_IF_MSG_RCVD_NTWRK_INFO:
--
2.7.4

2018-01-22 11:07:02

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef



On 22.01.2018 12:22, Ajay Singh wrote:
> Fix the "do not add new typedefs" issue found by checkpatch.pl
> script
>
>From https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
the the message body line is wrapped at 75 columns.


> Signed-off-by: Ajay Singh <[email protected]>
> Reviewed-by: Claudiu Beznea <[email protected]>
> ---
> drivers/staging/wilc1000/wilc_wlan_if.h | 72 ++++++++++++++++-----------------
> 1 file changed, 36 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
> index 1641ddb..e186509 100644
> --- a/drivers/staging/wilc1000/wilc_wlan_if.h
> +++ b/drivers/staging/wilc1000/wilc_wlan_if.h
> @@ -114,28 +114,28 @@ enum {
> G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
> };
>
> -typedef enum {
> +enum {
> G_SHORT_PREAMBLE = 0, /* Short Preamble */
> G_LONG_PREAMBLE = 1, /* Long Preamble */
> G_AUTO_PREAMBLE = 2, /* Auto Preamble Selection */
> -} G_PREAMBLE_T;
> +};
>
> #define MAC_CONNECTED 1
> #define MAC_DISCONNECTED 0
>
> #define SCAN_DONE TRUE
> -typedef enum {
> +enum {
> PASSIVE_SCAN = 0,
> ACTIVE_SCAN = 1,
> -} SCANTYPE_T;
> +};
>
> -typedef enum {
> +enum {
> NO_POWERSAVE = 0,
> MIN_FAST_PS = 1,
> MAX_FAST_PS = 2,
> MIN_PSPOLL_PS = 3,
> MAX_PSPOLL_PS = 4
> -} USER_PS_MODE_T;
> +};
>
> enum chip_ps_states {
> CHIP_WAKEDUP = 0,
> @@ -153,7 +153,7 @@ enum bus_release {
> RELEASE_ALLOW_SLEEP = 1,
> };
>
> -typedef enum {
> +enum {
> NO_SECURITY = 0,
> WEP_40 = 0x3,
> WEP_104 = 0x7,
> @@ -163,7 +163,7 @@ typedef enum {
> WPA2_AES = 0x31,
> WPA2_TKIP = 0x51,
> WPA2_AES_TKIP = 0x71, /* Aes or Tkip */
> -} SECURITY_T;
> +};
>
> enum AUTHTYPE {
> OPEN_SYSTEM = 1,
> @@ -178,88 +178,88 @@ enum SITESURVEY {
> SITE_SURVEY_OFF = 2
> };
>
> -typedef enum {
> +enum {
> NORMAL_ACK = 0,
> NO_ACK,
> -} ACK_POLICY_T;
> +};
>
> -typedef enum {
> +enum {
> DONT_RESET = 0,
> DO_RESET = 1,
> NO_REQUEST = 2,
> -} RESET_REQ_T;
> +};
>
> -typedef enum {
> +enum {
> REKEY_DISABLE = 1,
> REKEY_TIME_BASE,
> REKEY_PKT_BASE,
> REKEY_TIME_PKT_BASE
> -} RSNA_REKEY_POLICY_T;
> +};
>
> -typedef enum {
> +enum {
> FILTER_NO = 0x00,
> FILTER_AP_ONLY = 0x01,
> FILTER_STA_ONLY = 0x02
> -} SCAN_CLASS_FITLER_T;
> +};
>
> -typedef enum {
> +enum {
> PRI_HIGH_RSSI = 0x00,
> PRI_LOW_RSSI = 0x04,
> PRI_DETECT = 0x08
> -} SCAN_PRI_T;
> +};
>
> -typedef enum {
> +enum {
> CH_FILTER_OFF = 0x00,
> CH_FILTER_ON = 0x10
> -} CH_FILTER_T;
> +};
>
> -typedef enum {
> +enum {
> AUTO_PROT = 0, /* Auto */
> NO_PROT, /* Do not use any protection */
> ERP_PROT, /* Protect all ERP frame exchanges */
> HT_PROT, /* Protect all HT frame exchanges */
> GF_PROT, /* Protect all GF frame exchanges */
> -} N_PROTECTION_MODE_T;
> +};
>
> -typedef enum {
> +enum {
> G_SELF_CTS_PROT,
> G_RTS_CTS_PROT,
> -} G_PROTECTION_MODE_T;
> +};
>
> -typedef enum {
> +enum {
> HT_MIXED_MODE = 1,
> HT_ONLY_20MHZ_MODE,
> HT_ONLY_20_40MHZ_MODE,
> -} N_OPERATING_MODE_T;
> +};
>
> -typedef enum {
> +enum {
> NO_DETECT = 0,
> DETECT_ONLY = 1,
> DETECT_PROTECT = 2,
> DETECT_PROTECT_REPORT = 3,
> -} N_OBSS_DETECTION_T;
> +};
>
> -typedef enum {
> +enum {
> RTS_CTS_NONHT_PROT = 0, /* RTS-CTS at non-HT rate */
> FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
> LSIG_TXOP_PROT, /* LSIG TXOP Protection */
> FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
> -} N_PROTECTION_TYPE_T;
> +};
>
> -typedef enum {
> +enum {
> STATIC_MODE = 1,
> DYNAMIC_MODE = 2,
> MIMO_MODE = 3, /* power save disable */
> -} N_SMPS_MODE_T;
> +};
>
> -typedef enum {
> +enum {
> DISABLE_SELF_CTS,
> ENABLE_SELF_CTS,
> DISABLE_TX_ABORT,
> ENABLE_TX_ABORT,
> HW_TRIGGER_ABORT,
> SW_TRIGGER_ABORT,
> -} TX_ABORT_OPTION_T;
> +};
>
> enum wid_type {
> WID_CHAR = 0,
> @@ -281,7 +281,7 @@ struct wid {
> s8 *val;
> };
>
> -typedef enum {
> +enum {
> WID_NIL = 0xffff,
>
> /*
> @@ -889,7 +889,7 @@ typedef enum {
> /* Miscellaneous WIDs */
> WID_ALL = 0x7FFE,
> WID_MAX = 0xFFFF
> -} WID_T;
> +};
>
> struct wilc;
> int wilc_wlan_init(struct net_device *dev);
>

2018-01-22 10:23:37

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 14/14] staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
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 6e462db..38b2f2e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1158,7 +1158,7 @@ static s32 handle_connect(struct wilc_vif *vif,
return result;
}

-static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
+static s32 handle_connect_timeout(struct wilc_vif *vif)
{
s32 result = 0;
struct connect_info conn_info;
@@ -1518,7 +1518,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
return result;
}

-static int Handle_Key(struct wilc_vif *vif,
+static int handle_key(struct wilc_vif *vif,
struct key_attr *pstrHostIFkeyAttr)
{
s32 result = 0;
@@ -2504,7 +2504,7 @@ static void host_if_work(struct work_struct *work)
break;

case HOST_IF_MSG_KEY:
- Handle_Key(msg->vif, &msg->body.key_info);
+ handle_key(msg->vif, &msg->body.key_info);
break;

case HOST_IF_MSG_CFG_PARAMS:
@@ -2571,7 +2571,7 @@ static void host_if_work(struct work_struct *work)
break;

case HOST_IF_MSG_CONNECT_TIMER_FIRED:
- Handle_ConnectTimeout(msg->vif);
+ handle_connect_timeout(msg->vif);
break;

case HOST_IF_MSG_POWER_MGMT:
--
2.7.4

2018-01-22 11:54:17

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase

My comments to this series were only notes to be taken
into account for future patches.

Thank you,
Claudiu Beznea

On 22.01.2018 12:22, Ajay Singh wrote:
> This patch series contains changes to fix issues reported by checkpatch.pl script.
>
> Changes since v1:
> * Patch0004: Used "host_int_parse_join_bss_param" for function name.
> * Patch0009: Put memcpy statement in single line instead of using two lines.
> * Patch0010: Used "bss_param" for variable name instead of j_bss_param.
> * Added "Reviewed-by: Claudiu Beznea <[email protected]>" for commit description.
> * Modify the commit description to start with capital letter for all patch.
>
>
> Ajay Singh (14):
> staging: wilc1000: remove unnecessary use of parentheses
> staging: wilc1000: removed unnecessary defined enums typedef
> staging: wilc1000: fix alignments to match open parenthesis
> staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
> variable using camelCase
> staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
> variable
> staging: wilc1000: rename strWIDList variable to wid_list to avoid
> camelCase
> staging: wilc1000: rename u32WidsCount variable to avoid camelCase
> staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
> staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
> camelCase
> staging: wilc1000: rename ptstrJoinBssParam variable to avoid
> camelCase
> staging: wilc1000: rename strConnectInfo variable to avoid camelCase
> staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
> staging: wilc1000: rename Handle_Connect() to avoid camelCase
> staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()
>
> drivers/staging/wilc1000/coreconfigurator.c | 2 +-
> drivers/staging/wilc1000/host_interface.c | 937 +++++++++++-----------
> drivers/staging/wilc1000/linux_wlan.c | 10 +-
> drivers/staging/wilc1000/wilc_sdio.c | 4 +-
> drivers/staging/wilc1000/wilc_spi.c | 20 +-
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 64 +-
> drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
> drivers/staging/wilc1000/wilc_wlan_if.h | 72 +-
> 9 files changed, 555 insertions(+), 562 deletions(-)
>

2018-01-29 18:14:49

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

Hi Ajay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[cannot apply to v4.15 next-20180126]
[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/Ajay-Singh/fix-to-remove-unnecessary-parenthesis-typedef-and-avoid-camelCase/20180123-115314

New smatch warnings:
drivers/staging/wilc1000/host_interface.c:937 handle_connect() error: potential null dereference 'hif_drv->usr_conn_req.ssid'. (kmalloc returns null)

Old smatch warnings:
drivers/staging/wilc1000/host_interface.c:514 handle_cfg_param() warn: always true condition '(cfg_param_attr->auth_timeout < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:583 handle_cfg_param() warn: always true condition '(cfg_param_attr->rts_threshold < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:636 handle_cfg_param() warn: always true condition '(cfg_param_attr->beacon_interval < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:677 handle_cfg_param() warn: always true condition '(cfg_param_attr->site_survey_scan_time < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:691 handle_cfg_param() warn: always true condition '(cfg_param_attr->active_scan_time < 65536) => (0-u16max < 65536)'
drivers/staging/wilc1000/host_interface.c:705 handle_cfg_param() warn: always true condition '(cfg_param_attr->passive_scan_time < 65536) => (0-u16max < 65536)'

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

c5c77ba1 Johnny Kim 2015-05-11 903
e554a305 Leo Kim 2015-11-19 904 u8 wilc_connected_ssid[6] = {0};
cd1931cf Ajay Singh 2018-01-22 905 static s32 handle_connect(struct wilc_vif *vif,
3891285c Ajay Singh 2018-01-22 906 struct connect_attr *attr)
c5c77ba1 Johnny Kim 2015-05-11 907 {
31390eec Leo Kim 2015-10-19 908 s32 result = 0;
5a99cdf9 Ajay Singh 2018-01-22 909 struct wid wid_list[8];
7046f41b Ajay Singh 2018-01-22 910 u32 wid_cnt = 0, dummyval = 0;
44ea7461 Ajay Singh 2018-01-22 911 u8 *cur_byte = NULL;
5e18dd82 Ajay Singh 2018-01-22 912 struct join_bss_param *bss_param;
71130e81 Glen Lee 2015-12-21 913 struct host_if_drv *hif_drv = vif->hif_drv;
c5c77ba1 Johnny Kim 2015-05-11 914
3891285c Ajay Singh 2018-01-22 915 if (memcmp(attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
31390eec Leo Kim 2015-10-19 916 result = 0;
b92f9304 Chris Park 2016-02-22 917 netdev_err(vif->ndev, "Discard connect request\n");
31390eec Leo Kim 2015-10-19 918 return result;
c5c77ba1 Johnny Kim 2015-05-11 919 }
c5c77ba1 Johnny Kim 2015-05-11 920
5e18dd82 Ajay Singh 2018-01-22 921 bss_param = attr->params;
5e18dd82 Ajay Singh 2018-01-22 922 if (!bss_param) {
b92f9304 Chris Park 2016-02-22 923 netdev_err(vif->ndev, "Required BSSID not found\n");
31390eec Leo Kim 2015-10-19 924 result = -ENOENT;
24db713f Leo Kim 2015-09-16 925 goto ERRORHANDLER;
c5c77ba1 Johnny Kim 2015-05-11 926 }
c5c77ba1 Johnny Kim 2015-05-11 927
3891285c Ajay Singh 2018-01-22 928 if (attr->bssid) {
788f6fc0 Chaehyun Lim 2016-02-12 929 hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
3891285c Ajay Singh 2018-01-22 930 memcpy(hif_drv->usr_conn_req.bssid, attr->bssid, 6);
c5c77ba1 Johnny Kim 2015-05-11 931 }
c5c77ba1 Johnny Kim 2015-05-11 932
3891285c Ajay Singh 2018-01-22 933 hif_drv->usr_conn_req.ssid_len = attr->ssid_len;
3891285c Ajay Singh 2018-01-22 934 if (attr->ssid) {
3891285c Ajay Singh 2018-01-22 935 hif_drv->usr_conn_req.ssid = kmalloc(attr->ssid_len + 1, GFP_KERNEL);
3891285c Ajay Singh 2018-01-22 936 memcpy(hif_drv->usr_conn_req.ssid, attr->ssid, attr->ssid_len);
3891285c Ajay Singh 2018-01-22 @937 hif_drv->usr_conn_req.ssid[attr->ssid_len] = '\0';
c5c77ba1 Johnny Kim 2015-05-11 938 }
c5c77ba1 Johnny Kim 2015-05-11 939
3891285c Ajay Singh 2018-01-22 940 hif_drv->usr_conn_req.ies_len = attr->ies_len;
3891285c Ajay Singh 2018-01-22 941 if (attr->ies) {
3891285c Ajay Singh 2018-01-22 942 hif_drv->usr_conn_req.ies = kmalloc(attr->ies_len, GFP_KERNEL);
3891285c Ajay Singh 2018-01-22 943 memcpy(hif_drv->usr_conn_req.ies, attr->ies, attr->ies_len);
c5c77ba1 Johnny Kim 2015-05-11 944 }
c5c77ba1 Johnny Kim 2015-05-11 945
3891285c Ajay Singh 2018-01-22 946 hif_drv->usr_conn_req.security = attr->security;
3891285c Ajay Singh 2018-01-22 947 hif_drv->usr_conn_req.auth_type = attr->auth_type;
3891285c Ajay Singh 2018-01-22 948 hif_drv->usr_conn_req.conn_result = attr->result;
3891285c Ajay Singh 2018-01-22 949 hif_drv->usr_conn_req.arg = attr->arg;
c5c77ba1 Johnny Kim 2015-05-11 950
7046f41b Ajay Singh 2018-01-22 951 wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
7046f41b Ajay Singh 2018-01-22 952 wid_list[wid_cnt].type = WID_INT;
7046f41b Ajay Singh 2018-01-22 953 wid_list[wid_cnt].size = sizeof(u32);
7046f41b Ajay Singh 2018-01-22 954 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
7046f41b Ajay Singh 2018-01-22 955 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 956
7046f41b Ajay Singh 2018-01-22 957 wid_list[wid_cnt].id = WID_RECEIVED_FRAGMENT_COUNT;
7046f41b Ajay Singh 2018-01-22 958 wid_list[wid_cnt].type = WID_INT;
7046f41b Ajay Singh 2018-01-22 959 wid_list[wid_cnt].size = sizeof(u32);
7046f41b Ajay Singh 2018-01-22 960 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
7046f41b Ajay Singh 2018-01-22 961 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 962
7046f41b Ajay Singh 2018-01-22 963 wid_list[wid_cnt].id = WID_FAILED_COUNT;
7046f41b Ajay Singh 2018-01-22 964 wid_list[wid_cnt].type = WID_INT;
7046f41b Ajay Singh 2018-01-22 965 wid_list[wid_cnt].size = sizeof(u32);
7046f41b Ajay Singh 2018-01-22 966 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
7046f41b Ajay Singh 2018-01-22 967 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 968
c5c77ba1 Johnny Kim 2015-05-11 969 {
7046f41b Ajay Singh 2018-01-22 970 wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
7046f41b Ajay Singh 2018-01-22 971 wid_list[wid_cnt].type = WID_BIN_DATA;
7046f41b Ajay Singh 2018-01-22 972 wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
7046f41b Ajay Singh 2018-01-22 973 wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
7046f41b Ajay Singh 2018-01-22 974 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 975
3891285c Ajay Singh 2018-01-22 976 if (memcmp("DIRECT-", attr->ssid, 7)) {
331ed080 Leo Kim 2015-10-29 977 info_element_size = hif_drv->usr_conn_req.ies_len;
dfef7b84 Leo Kim 2015-10-15 978 info_element = kmalloc(info_element_size, GFP_KERNEL);
a3b2f4b9 Leo Kim 2015-10-29 979 memcpy(info_element, hif_drv->usr_conn_req.ies,
dfef7b84 Leo Kim 2015-10-15 980 info_element_size);
c5c77ba1 Johnny Kim 2015-05-11 981 }
c5c77ba1 Johnny Kim 2015-05-11 982 }
7046f41b Ajay Singh 2018-01-22 983 wid_list[wid_cnt].id = (u16)WID_11I_MODE;
7046f41b Ajay Singh 2018-01-22 984 wid_list[wid_cnt].type = WID_CHAR;
7046f41b Ajay Singh 2018-01-22 985 wid_list[wid_cnt].size = sizeof(char);
7046f41b Ajay Singh 2018-01-22 986 wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
7046f41b Ajay Singh 2018-01-22 987 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 988
3891285c Ajay Singh 2018-01-22 989 if (memcmp("DIRECT-", attr->ssid, 7))
a0942c57 Chaehyun Lim 2016-02-12 990 mode_11i = hif_drv->usr_conn_req.security;
c5c77ba1 Johnny Kim 2015-05-11 991
7046f41b Ajay Singh 2018-01-22 992 wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
7046f41b Ajay Singh 2018-01-22 993 wid_list[wid_cnt].type = WID_CHAR;
7046f41b Ajay Singh 2018-01-22 994 wid_list[wid_cnt].size = sizeof(char);
7046f41b Ajay Singh 2018-01-22 995 wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
7046f41b Ajay Singh 2018-01-22 996 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 997
3891285c Ajay Singh 2018-01-22 998 if (memcmp("DIRECT-", attr->ssid, 7))
7d069728 Leo Kim 2015-10-29 999 auth_type = (u8)hif_drv->usr_conn_req.auth_type;
c5c77ba1 Johnny Kim 2015-05-11 1000
7046f41b Ajay Singh 2018-01-22 1001 wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
7046f41b Ajay Singh 2018-01-22 1002 wid_list[wid_cnt].type = WID_STR;
7046f41b Ajay Singh 2018-01-22 1003 wid_list[wid_cnt].size = 112;
7046f41b Ajay Singh 2018-01-22 1004 wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);
c5c77ba1 Johnny Kim 2015-05-11 1005
3891285c Ajay Singh 2018-01-22 1006 if (memcmp("DIRECT-", attr->ssid, 7)) {
7046f41b Ajay Singh 2018-01-22 1007 join_req_size = wid_list[wid_cnt].size;
0626baaa Leo Kim 2015-10-15 1008 join_req = kmalloc(join_req_size, GFP_KERNEL);
c5c77ba1 Johnny Kim 2015-05-11 1009 }
7046f41b Ajay Singh 2018-01-22 1010 if (!wid_list[wid_cnt].val) {
31390eec Leo Kim 2015-10-19 1011 result = -EFAULT;
24db713f Leo Kim 2015-09-16 1012 goto ERRORHANDLER;
24db713f Leo Kim 2015-09-16 1013 }
c5c77ba1 Johnny Kim 2015-05-11 1014
44ea7461 Ajay Singh 2018-01-22 1015 cur_byte = wid_list[wid_cnt].val;
c5c77ba1 Johnny Kim 2015-05-11 1016
3891285c Ajay Singh 2018-01-22 1017 if (attr->ssid) {
3891285c Ajay Singh 2018-01-22 1018 memcpy(cur_byte, attr->ssid, attr->ssid_len);
3891285c Ajay Singh 2018-01-22 1019 cur_byte[attr->ssid_len] = '\0';
c5c77ba1 Johnny Kim 2015-05-11 1020 }
44ea7461 Ajay Singh 2018-01-22 1021 cur_byte += MAX_SSID_LEN;
44ea7461 Ajay Singh 2018-01-22 1022 *(cur_byte++) = INFRASTRUCTURE;
ae4dfa57 Leo Kim 2015-10-13 1023
3891285c Ajay Singh 2018-01-22 1024 if (attr->ch >= 1 && attr->ch <= 14) {
3891285c Ajay Singh 2018-01-22 1025 *(cur_byte++) = attr->ch;
c5c77ba1 Johnny Kim 2015-05-11 1026 } else {
b92f9304 Chris Park 2016-02-22 1027 netdev_err(vif->ndev, "Channel out of range\n");
44ea7461 Ajay Singh 2018-01-22 1028 *(cur_byte++) = 0xFF;
c5c77ba1 Johnny Kim 2015-05-11 1029 }
5e18dd82 Ajay Singh 2018-01-22 1030 *(cur_byte++) = (bss_param->cap_info) & 0xFF;
5e18dd82 Ajay Singh 2018-01-22 1031 *(cur_byte++) = ((bss_param->cap_info) >> 8) & 0xFF;
c5c77ba1 Johnny Kim 2015-05-11 1032
3891285c Ajay Singh 2018-01-22 1033 if (attr->bssid)
3891285c Ajay Singh 2018-01-22 1034 memcpy(cur_byte, attr->bssid, 6);
44ea7461 Ajay Singh 2018-01-22 1035 cur_byte += 6;
c5c77ba1 Johnny Kim 2015-05-11 1036
3891285c Ajay Singh 2018-01-22 1037 if (attr->bssid)
3891285c Ajay Singh 2018-01-22 1038 memcpy(cur_byte, attr->bssid, 6);
44ea7461 Ajay Singh 2018-01-22 1039 cur_byte += 6;
c0f52fba Tony Cho 2015-10-20 1040
5e18dd82 Ajay Singh 2018-01-22 1041 *(cur_byte++) = (bss_param->beacon_period) & 0xFF;
5e18dd82 Ajay Singh 2018-01-22 1042 *(cur_byte++) = ((bss_param->beacon_period) >> 8) & 0xFF;
5e18dd82 Ajay Singh 2018-01-22 1043 *(cur_byte++) = bss_param->dtim_period;
ae4dfa57 Leo Kim 2015-10-13 1044
5e18dd82 Ajay Singh 2018-01-22 1045 memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1);
44ea7461 Ajay Singh 2018-01-22 1046 cur_byte += (MAX_RATES_SUPPORTED + 1);
c5c77ba1 Johnny Kim 2015-05-11 1047
5e18dd82 Ajay Singh 2018-01-22 1048 *(cur_byte++) = bss_param->wmm_cap;
5e18dd82 Ajay Singh 2018-01-22 1049 *(cur_byte++) = bss_param->uapsd_cap;
c5c77ba1 Johnny Kim 2015-05-11 1050
5e18dd82 Ajay Singh 2018-01-22 1051 *(cur_byte++) = bss_param->ht_capable;
5e18dd82 Ajay Singh 2018-01-22 1052 hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable;
c5c77ba1 Johnny Kim 2015-05-11 1053
5e18dd82 Ajay Singh 2018-01-22 1054 *(cur_byte++) = bss_param->rsn_found;
5e18dd82 Ajay Singh 2018-01-22 1055 *(cur_byte++) = bss_param->rsn_grp_policy;
5e18dd82 Ajay Singh 2018-01-22 1056 *(cur_byte++) = bss_param->mode_802_11i;
ae4dfa57 Leo Kim 2015-10-13 1057
5e18dd82 Ajay Singh 2018-01-22 1058 memcpy(cur_byte, bss_param->rsn_pcip_policy, sizeof(bss_param->rsn_pcip_policy));
5e18dd82 Ajay Singh 2018-01-22 1059 cur_byte += sizeof(bss_param->rsn_pcip_policy);
c5c77ba1 Johnny Kim 2015-05-11 1060
5e18dd82 Ajay Singh 2018-01-22 1061 memcpy(cur_byte, bss_param->rsn_auth_policy, sizeof(bss_param->rsn_auth_policy));
5e18dd82 Ajay Singh 2018-01-22 1062 cur_byte += sizeof(bss_param->rsn_auth_policy);
c5c77ba1 Johnny Kim 2015-05-11 1063
5e18dd82 Ajay Singh 2018-01-22 1064 memcpy(cur_byte, bss_param->rsn_cap, sizeof(bss_param->rsn_cap));
5e18dd82 Ajay Singh 2018-01-22 1065 cur_byte += sizeof(bss_param->rsn_cap);
c5c77ba1 Johnny Kim 2015-05-11 1066
44ea7461 Ajay Singh 2018-01-22 1067 *(cur_byte++) = REAL_JOIN_REQ;
5e18dd82 Ajay Singh 2018-01-22 1068 *(cur_byte++) = bss_param->noa_enabled;
c5c77ba1 Johnny Kim 2015-05-11 1069
5e18dd82 Ajay Singh 2018-01-22 1070 if (bss_param->noa_enabled) {
5e18dd82 Ajay Singh 2018-01-22 1071 *(cur_byte++) = (bss_param->tsf) & 0xFF;
5e18dd82 Ajay Singh 2018-01-22 1072 *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF;
5e18dd82 Ajay Singh 2018-01-22 1073 *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF;
5e18dd82 Ajay Singh 2018-01-22 1074 *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF;
c5c77ba1 Johnny Kim 2015-05-11 1075
5e18dd82 Ajay Singh 2018-01-22 1076 *(cur_byte++) = bss_param->opp_enabled;
5e18dd82 Ajay Singh 2018-01-22 1077 *(cur_byte++) = bss_param->idx;
c5c77ba1 Johnny Kim 2015-05-11 1078
5e18dd82 Ajay Singh 2018-01-22 1079 if (bss_param->opp_enabled)
5e18dd82 Ajay Singh 2018-01-22 1080 *(cur_byte++) = bss_param->ct_window;
c5c77ba1 Johnny Kim 2015-05-11 1081
5e18dd82 Ajay Singh 2018-01-22 1082 *(cur_byte++) = bss_param->cnt;
c5c77ba1 Johnny Kim 2015-05-11 1083
5e18dd82 Ajay Singh 2018-01-22 1084 memcpy(cur_byte, bss_param->duration, sizeof(bss_param->duration));
5e18dd82 Ajay Singh 2018-01-22 1085 cur_byte += sizeof(bss_param->duration);
c5c77ba1 Johnny Kim 2015-05-11 1086
5e18dd82 Ajay Singh 2018-01-22 1087 memcpy(cur_byte, bss_param->interval, sizeof(bss_param->interval));
5e18dd82 Ajay Singh 2018-01-22 1088 cur_byte += sizeof(bss_param->interval);
c5c77ba1 Johnny Kim 2015-05-11 1089
5e18dd82 Ajay Singh 2018-01-22 1090 memcpy(cur_byte, bss_param->start_time, sizeof(bss_param->start_time));
5e18dd82 Ajay Singh 2018-01-22 1091 cur_byte += sizeof(bss_param->start_time);
c4f97526 Chris Park 2016-02-04 1092 }
c5c77ba1 Johnny Kim 2015-05-11 1093
44ea7461 Ajay Singh 2018-01-22 1094 cur_byte = wid_list[wid_cnt].val;
7046f41b Ajay Singh 2018-01-22 1095 wid_cnt++;
c5c77ba1 Johnny Kim 2015-05-11 1096
3891285c Ajay Singh 2018-01-22 1097 if (memcmp("DIRECT-", attr->ssid, 7)) {
44ea7461 Ajay Singh 2018-01-22 1098 memcpy(join_req, cur_byte, join_req_size);
7036c624 Glen Lee 2015-12-21 1099 join_req_vif = vif;
c5c77ba1 Johnny Kim 2015-05-11 1100 }
c5c77ba1 Johnny Kim 2015-05-11 1101
3891285c Ajay Singh 2018-01-22 1102 if (attr->bssid)
3891285c Ajay Singh 2018-01-22 1103 memcpy(wilc_connected_ssid,attr->bssid, ETH_ALEN);
c5c77ba1 Johnny Kim 2015-05-11 1104
5a99cdf9 Ajay Singh 2018-01-22 1105 result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
7046f41b Ajay Singh 2018-01-22 1106 wid_cnt,
eb9939b7 Glen Lee 2015-12-21 1107 wilc_get_vif_idx(vif));
31390eec Leo Kim 2015-10-19 1108 if (result) {
b92f9304 Chris Park 2016-02-22 1109 netdev_err(vif->ndev, "failed to send config packet\n");
31390eec Leo Kim 2015-10-19 1110 result = -EFAULT;
24db713f Leo Kim 2015-09-16 1111 goto ERRORHANDLER;
c5c77ba1 Johnny Kim 2015-05-11 1112 } else {
b60005a8 Leo Kim 2015-10-29 1113 hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
c5c77ba1 Johnny Kim 2015-05-11 1114 }
c5c77ba1 Johnny Kim 2015-05-11 1115
24db713f Leo Kim 2015-09-16 1116 ERRORHANDLER:
31390eec Leo Kim 2015-10-19 1117 if (result) {
6a247004 Ajay Singh 2018-01-22 1118 struct connect_info conn_info;
c5c77ba1 Johnny Kim 2015-05-11 1119
81a59506 Leo Kim 2015-10-29 1120 del_timer(&hif_drv->connect_timer);
c5c77ba1 Johnny Kim 2015-05-11 1121
6a247004 Ajay Singh 2018-01-22 1122 memset(&conn_info, 0, sizeof(struct connect_info));
c5c77ba1 Johnny Kim 2015-05-11 1123
3891285c Ajay Singh 2018-01-22 1124 if (attr->result) {
3891285c Ajay Singh 2018-01-22 1125 if (attr->bssid)
6a247004 Ajay Singh 2018-01-22 1126 memcpy(conn_info.bssid, attr->bssid, 6);
c5c77ba1 Johnny Kim 2015-05-11 1127
3891285c Ajay Singh 2018-01-22 1128 if (attr->ies) {
6a247004 Ajay Singh 2018-01-22 1129 conn_info.req_ies_len = attr->ies_len;
6a247004 Ajay Singh 2018-01-22 1130 conn_info.req_ies = kmalloc(attr->ies_len, GFP_KERNEL);
6a247004 Ajay Singh 2018-01-22 1131 memcpy(conn_info.req_ies, attr->ies, attr->ies_len);
c5c77ba1 Johnny Kim 2015-05-11 1132 }
c5c77ba1 Johnny Kim 2015-05-11 1133
3891285c Ajay Singh 2018-01-22 1134 attr->result(CONN_DISCONN_EVENT_CONN_RESP,
6a247004 Ajay Singh 2018-01-22 1135 &conn_info,
c5c77ba1 Johnny Kim 2015-05-11 1136 MAC_DISCONNECTED,
c5c77ba1 Johnny Kim 2015-05-11 1137 NULL,
3891285c Ajay Singh 2018-01-22 1138 attr->arg);
b60005a8 Leo Kim 2015-10-29 1139 hif_drv->hif_state = HOST_IF_IDLE;
6a247004 Ajay Singh 2018-01-22 1140 kfree(conn_info.req_ies);
6a247004 Ajay Singh 2018-01-22 1141 conn_info.req_ies = NULL;
c5c77ba1 Johnny Kim 2015-05-11 1142
c5c77ba1 Johnny Kim 2015-05-11 1143 } else {
b92f9304 Chris Park 2016-02-22 1144 netdev_err(vif->ndev, "Connect callback is NULL\n");
c5c77ba1 Johnny Kim 2015-05-11 1145 }
c5c77ba1 Johnny Kim 2015-05-11 1146 }
c5c77ba1 Johnny Kim 2015-05-11 1147
3891285c Ajay Singh 2018-01-22 1148 kfree(attr->bssid);
3891285c Ajay Singh 2018-01-22 1149 attr->bssid = NULL;
c5c77ba1 Johnny Kim 2015-05-11 1150
3891285c Ajay Singh 2018-01-22 1151 kfree(attr->ssid);
3891285c Ajay Singh 2018-01-22 1152 attr->ssid = NULL;
c5c77ba1 Johnny Kim 2015-05-11 1153
3891285c Ajay Singh 2018-01-22 1154 kfree(attr->ies);
3891285c Ajay Singh 2018-01-22 1155 attr->ies = NULL;
c5c77ba1 Johnny Kim 2015-05-11 1156
44ea7461 Ajay Singh 2018-01-22 1157 kfree(cur_byte);
31390eec Leo Kim 2015-10-19 1158 return result;
c5c77ba1 Johnny Kim 2015-05-11 1159 }
c5c77ba1 Johnny Kim 2015-05-11 1160

:::::: The code at line 937 was first introduced by commit
:::::: 3891285c9a8a05a4789a3c286d7f9bdbde6b23c7 staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid camelCase

:::::: TO: Ajay Singh <[email protected]>
:::::: CC: 0day robot <[email protected]>

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

2018-01-22 10:23:09

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 05/14] staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its variable

Fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 8f8e727..f0168e3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2123,34 +2123,34 @@ static void Handle_AddStation(struct wilc_vif *vif,
kfree(wid.val);
}

-static void Handle_DelAllSta(struct wilc_vif *vif,
- struct del_all_sta *pstrDelAllStaParam)
+static void handle_del_all_sta(struct wilc_vif *vif,
+ struct del_all_sta *param)
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *curr_byte;
u8 i;
- u8 au8Zero_Buff[6] = {0};
+ u8 zero_buff[6] = {0};

wid.id = (u16)WID_DEL_ALL_STA;
wid.type = WID_STR;
- wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1;
+ wid.size = (param->assoc_sta * ETH_ALEN) + 1;

- wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL);
+ wid.val = kmalloc((param->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL);
if (!wid.val)
goto ERRORHANDLER;

- pu8CurrByte = wid.val;
+ curr_byte = wid.val;

- *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta;
+ *(curr_byte++) = param->assoc_sta;

for (i = 0; i < MAX_NUM_STA; i++) {
- if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, ETH_ALEN))
- memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], ETH_ALEN);
+ if (memcmp(param->del_all_sta[i], zero_buff, ETH_ALEN))
+ memcpy(curr_byte, param->del_all_sta[i], ETH_ALEN);
else
continue;

- pu8CurrByte += ETH_ALEN;
+ curr_byte += ETH_ALEN;
}

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
@@ -2626,7 +2626,7 @@ static void host_if_work(struct work_struct *work)
break;

case HOST_IF_MSG_DEL_ALL_STA:
- Handle_DelAllSta(msg->vif, &msg->body.del_all_sta_info);
+ handle_del_all_sta(msg->vif, &msg->body.del_all_sta_info);
break;

case HOST_IF_MSG_SET_TX_POWER:
--
2.7.4

2018-01-22 11:10:50

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase



On 22.01.2018 12:22, Ajay Singh wrote:
> This patch series contains changes to fix issues reported by checkpatch.pl script.
>
> Changes since v1:
> * Patch0004: Used "host_int_parse_join_bss_param" for function name.
> * Patch0009: Put memcpy statement in single line instead of using two lines.
> * Patch0010: Used "bss_param" for variable name instead of j_bss_param.
> * Added "Reviewed-by: Claudiu Beznea <[email protected]>" for commit description.
> * Modify the commit description to start with capital letter for all patch.
You forgot to do it for patches 3 and 8.
>
>
> Ajay Singh (14):
> staging: wilc1000: remove unnecessary use of parentheses
> staging: wilc1000: removed unnecessary defined enums typedef
> staging: wilc1000: fix alignments to match open parenthesis
> staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
> variable using camelCase
> staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
> variable
> staging: wilc1000: rename strWIDList variable to wid_list to avoid
> camelCase
> staging: wilc1000: rename u32WidsCount variable to avoid camelCase
> staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
> staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
> camelCase
> staging: wilc1000: rename ptstrJoinBssParam variable to avoid
> camelCase
> staging: wilc1000: rename strConnectInfo variable to avoid camelCase
> staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
> staging: wilc1000: rename Handle_Connect() to avoid camelCase
> staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()
>
> drivers/staging/wilc1000/coreconfigurator.c | 2 +-
> drivers/staging/wilc1000/host_interface.c | 937 +++++++++++-----------
> drivers/staging/wilc1000/linux_wlan.c | 10 +-
> drivers/staging/wilc1000/wilc_sdio.c | 4 +-
> drivers/staging/wilc1000/wilc_spi.c | 20 +-
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 64 +-
> drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
> drivers/staging/wilc1000/wilc_wlan_if.h | 72 +-
> 9 files changed, 555 insertions(+), 562 deletions(-)
>

2018-01-30 13:59:42

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

On Tue, 30 Jan 2018 02:13:53 +0800
kbuild test robot <[email protected]> wrote:

> Hi Ajay,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on staging/staging-testing]
> [cannot apply to v4.15 next-20180126]
> [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/Ajay-Singh/fix-to-remove-unnecessary-parenthesis-typedef-and-avoid-camelCase/20180123-115314
>
> New smatch warnings:
> drivers/staging/wilc1000/host_interface.c:937 handle_connect() error: potential null dereference 'hif_drv->usr_conn_req.ssid'. (kmalloc returns null)
>
> Old smatch warnings:
> drivers/staging/wilc1000/host_interface.c:514 handle_cfg_param() warn: always true condition '(cfg_param_attr->auth_timeout < 65536) => (0-u16max < 65536)'
> drivers/staging/wilc1000/host_interface.c:583 handle_cfg_param() warn: always true condition '(cfg_param_attr->rts_threshold < 65536) => (0-u16max < 65536)'
> drivers/staging/wilc1000/host_interface.c:636 handle_cfg_param() warn: always true condition '(cfg_param_attr->beacon_interval < 65536) => (0-u16max < 65536)'
> drivers/staging/wilc1000/host_interface.c:677 handle_cfg_param() warn: always true condition '(cfg_param_attr->site_survey_scan_time < 65536) => (0-u16max < 65536)'
> drivers/staging/wilc1000/host_interface.c:691 handle_cfg_param() warn: always true condition '(cfg_param_attr->active_scan_time < 65536) => (0-u16max < 65536)'
> drivers/staging/wilc1000/host_interface.c:705 handle_cfg_param() warn: always true condition '(cfg_param_attr->passive_scan_time < 65536) => (0-u16max < 65536)'
>
> vim +937 drivers/staging/wilc1000/host_interface.c
>
> c5c77ba1 Johnny Kim 2015-05-11 903
> e554a305 Leo Kim 2015-11-19 904 u8 wilc_connected_ssid[6] = {0};
> cd1931cf Ajay Singh 2018-01-22 905 static s32 handle_connect(struct wilc_vif *vif,
> 3891285c Ajay Singh 2018-01-22 906 struct connect_attr *attr)
> c5c77ba1 Johnny Kim 2015-05-11 907 {
> 31390eec Leo Kim 2015-10-19 908 s32 result = 0;
> 5a99cdf9 Ajay Singh 2018-01-22 909 struct wid wid_list[8];
> 7046f41b Ajay Singh 2018-01-22 910 u32 wid_cnt = 0, dummyval = 0;
> 44ea7461 Ajay Singh 2018-01-22 911 u8 *cur_byte = NULL;
> 5e18dd82 Ajay Singh 2018-01-22 912 struct join_bss_param *bss_param;
> 71130e81 Glen Lee 2015-12-21 913 struct host_if_drv *hif_drv = vif->hif_drv;
> c5c77ba1 Johnny Kim 2015-05-11 914
> 3891285c Ajay Singh 2018-01-22 915 if (memcmp(attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
> 31390eec Leo Kim 2015-10-19 916 result = 0;
> b92f9304 Chris Park 2016-02-22 917 netdev_err(vif->ndev, "Discard connect request\n");
> 31390eec Leo Kim 2015-10-19 918 return result;
> c5c77ba1 Johnny Kim 2015-05-11 919 }
> c5c77ba1 Johnny Kim 2015-05-11 920
> 5e18dd82 Ajay Singh 2018-01-22 921 bss_param = attr->params;
> 5e18dd82 Ajay Singh 2018-01-22 922 if (!bss_param) {
> b92f9304 Chris Park 2016-02-22 923 netdev_err(vif->ndev, "Required BSSID not found\n");
> 31390eec Leo Kim 2015-10-19 924 result = -ENOENT;
> 24db713f Leo Kim 2015-09-16 925 goto ERRORHANDLER;
> c5c77ba1 Johnny Kim 2015-05-11 926 }
> c5c77ba1 Johnny Kim 2015-05-11 927
> 3891285c Ajay Singh 2018-01-22 928 if (attr->bssid) {
> 788f6fc0 Chaehyun Lim 2016-02-12 929 hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
> 3891285c Ajay Singh 2018-01-22 930 memcpy(hif_drv->usr_conn_req.bssid, attr->bssid, 6);
> c5c77ba1 Johnny Kim 2015-05-11 931 }
> c5c77ba1 Johnny Kim 2015-05-11 932
> 3891285c Ajay Singh 2018-01-22 933 hif_drv->usr_conn_req.ssid_len = attr->ssid_len;
> 3891285c Ajay Singh 2018-01-22 934 if (attr->ssid) {
> 3891285c Ajay Singh 2018-01-22 935 hif_drv->usr_conn_req.ssid = kmalloc(attr->ssid_len + 1, GFP_KERNEL);
> 3891285c Ajay Singh 2018-01-22 936 memcpy(hif_drv->usr_conn_req.ssid, attr->ssid, attr->ssid_len);
> 3891285c Ajay Singh 2018-01-22 @937 hif_drv->usr_conn_req.ssid[attr->ssid_len] = '\0';
> c5c77ba1 Johnny Kim 2015-05-11 938 }
> c5c77ba1 Johnny Kim 2015-05-11 939
> 3891285c Ajay Singh 2018-01-22 940 hif_drv->usr_conn_req.ies_len = attr->ies_len;
> 3891285c Ajay Singh 2018-01-22 941 if (attr->ies) {
> 3891285c Ajay Singh 2018-01-22 942 hif_drv->usr_conn_req.ies = kmalloc(attr->ies_len, GFP_KERNEL);
> 3891285c Ajay Singh 2018-01-22 943 memcpy(hif_drv->usr_conn_req.ies, attr->ies, attr->ies_len);
> c5c77ba1 Johnny Kim 2015-05-11 944 }
> c5c77ba1 Johnny Kim 2015-05-11 945
> 3891285c Ajay Singh 2018-01-22 946 hif_drv->usr_conn_req.security = attr->security;
> 3891285c Ajay Singh 2018-01-22 947 hif_drv->usr_conn_req.auth_type = attr->auth_type;
> 3891285c Ajay Singh 2018-01-22 948 hif_drv->usr_conn_req.conn_result = attr->result;
> 3891285c Ajay Singh 2018-01-22 949 hif_drv->usr_conn_req.arg = attr->arg;
> c5c77ba1 Johnny Kim 2015-05-11 950
> 7046f41b Ajay Singh 2018-01-22 951 wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
> 7046f41b Ajay Singh 2018-01-22 952 wid_list[wid_cnt].type = WID_INT;
> 7046f41b Ajay Singh 2018-01-22 953 wid_list[wid_cnt].size = sizeof(u32);
> 7046f41b Ajay Singh 2018-01-22 954 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
> 7046f41b Ajay Singh 2018-01-22 955 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 956
> 7046f41b Ajay Singh 2018-01-22 957 wid_list[wid_cnt].id = WID_RECEIVED_FRAGMENT_COUNT;
> 7046f41b Ajay Singh 2018-01-22 958 wid_list[wid_cnt].type = WID_INT;
> 7046f41b Ajay Singh 2018-01-22 959 wid_list[wid_cnt].size = sizeof(u32);
> 7046f41b Ajay Singh 2018-01-22 960 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
> 7046f41b Ajay Singh 2018-01-22 961 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 962
> 7046f41b Ajay Singh 2018-01-22 963 wid_list[wid_cnt].id = WID_FAILED_COUNT;
> 7046f41b Ajay Singh 2018-01-22 964 wid_list[wid_cnt].type = WID_INT;
> 7046f41b Ajay Singh 2018-01-22 965 wid_list[wid_cnt].size = sizeof(u32);
> 7046f41b Ajay Singh 2018-01-22 966 wid_list[wid_cnt].val = (s8 *)(&(dummyval));
> 7046f41b Ajay Singh 2018-01-22 967 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 968
> c5c77ba1 Johnny Kim 2015-05-11 969 {
> 7046f41b Ajay Singh 2018-01-22 970 wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
> 7046f41b Ajay Singh 2018-01-22 971 wid_list[wid_cnt].type = WID_BIN_DATA;
> 7046f41b Ajay Singh 2018-01-22 972 wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
> 7046f41b Ajay Singh 2018-01-22 973 wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
> 7046f41b Ajay Singh 2018-01-22 974 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 975
> 3891285c Ajay Singh 2018-01-22 976 if (memcmp("DIRECT-", attr->ssid, 7)) {
> 331ed080 Leo Kim 2015-10-29 977 info_element_size = hif_drv->usr_conn_req.ies_len;
> dfef7b84 Leo Kim 2015-10-15 978 info_element = kmalloc(info_element_size, GFP_KERNEL);
> a3b2f4b9 Leo Kim 2015-10-29 979 memcpy(info_element, hif_drv->usr_conn_req.ies,
> dfef7b84 Leo Kim 2015-10-15 980 info_element_size);
> c5c77ba1 Johnny Kim 2015-05-11 981 }
> c5c77ba1 Johnny Kim 2015-05-11 982 }
> 7046f41b Ajay Singh 2018-01-22 983 wid_list[wid_cnt].id = (u16)WID_11I_MODE;
> 7046f41b Ajay Singh 2018-01-22 984 wid_list[wid_cnt].type = WID_CHAR;
> 7046f41b Ajay Singh 2018-01-22 985 wid_list[wid_cnt].size = sizeof(char);
> 7046f41b Ajay Singh 2018-01-22 986 wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
> 7046f41b Ajay Singh 2018-01-22 987 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 988
> 3891285c Ajay Singh 2018-01-22 989 if (memcmp("DIRECT-", attr->ssid, 7))
> a0942c57 Chaehyun Lim 2016-02-12 990 mode_11i = hif_drv->usr_conn_req.security;
> c5c77ba1 Johnny Kim 2015-05-11 991
> 7046f41b Ajay Singh 2018-01-22 992 wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
> 7046f41b Ajay Singh 2018-01-22 993 wid_list[wid_cnt].type = WID_CHAR;
> 7046f41b Ajay Singh 2018-01-22 994 wid_list[wid_cnt].size = sizeof(char);
> 7046f41b Ajay Singh 2018-01-22 995 wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
> 7046f41b Ajay Singh 2018-01-22 996 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 997
> 3891285c Ajay Singh 2018-01-22 998 if (memcmp("DIRECT-", attr->ssid, 7))
> 7d069728 Leo Kim 2015-10-29 999 auth_type = (u8)hif_drv->usr_conn_req.auth_type;
> c5c77ba1 Johnny Kim 2015-05-11 1000
> 7046f41b Ajay Singh 2018-01-22 1001 wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
> 7046f41b Ajay Singh 2018-01-22 1002 wid_list[wid_cnt].type = WID_STR;
> 7046f41b Ajay Singh 2018-01-22 1003 wid_list[wid_cnt].size = 112;
> 7046f41b Ajay Singh 2018-01-22 1004 wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);
> c5c77ba1 Johnny Kim 2015-05-11 1005
> 3891285c Ajay Singh 2018-01-22 1006 if (memcmp("DIRECT-", attr->ssid, 7)) {
> 7046f41b Ajay Singh 2018-01-22 1007 join_req_size = wid_list[wid_cnt].size;
> 0626baaa Leo Kim 2015-10-15 1008 join_req = kmalloc(join_req_size, GFP_KERNEL);
> c5c77ba1 Johnny Kim 2015-05-11 1009 }
> 7046f41b Ajay Singh 2018-01-22 1010 if (!wid_list[wid_cnt].val) {
> 31390eec Leo Kim 2015-10-19 1011 result = -EFAULT;
> 24db713f Leo Kim 2015-09-16 1012 goto ERRORHANDLER;
> 24db713f Leo Kim 2015-09-16 1013 }
> c5c77ba1 Johnny Kim 2015-05-11 1014
> 44ea7461 Ajay Singh 2018-01-22 1015 cur_byte = wid_list[wid_cnt].val;
> c5c77ba1 Johnny Kim 2015-05-11 1016
> 3891285c Ajay Singh 2018-01-22 1017 if (attr->ssid) {
> 3891285c Ajay Singh 2018-01-22 1018 memcpy(cur_byte, attr->ssid, attr->ssid_len);
> 3891285c Ajay Singh 2018-01-22 1019 cur_byte[attr->ssid_len] = '\0';
> c5c77ba1 Johnny Kim 2015-05-11 1020 }
> 44ea7461 Ajay Singh 2018-01-22 1021 cur_byte += MAX_SSID_LEN;
> 44ea7461 Ajay Singh 2018-01-22 1022 *(cur_byte++) = INFRASTRUCTURE;
> ae4dfa57 Leo Kim 2015-10-13 1023
> 3891285c Ajay Singh 2018-01-22 1024 if (attr->ch >= 1 && attr->ch <= 14) {
> 3891285c Ajay Singh 2018-01-22 1025 *(cur_byte++) = attr->ch;
> c5c77ba1 Johnny Kim 2015-05-11 1026 } else {
> b92f9304 Chris Park 2016-02-22 1027 netdev_err(vif->ndev, "Channel out of range\n");
> 44ea7461 Ajay Singh 2018-01-22 1028 *(cur_byte++) = 0xFF;
> c5c77ba1 Johnny Kim 2015-05-11 1029 }
> 5e18dd82 Ajay Singh 2018-01-22 1030 *(cur_byte++) = (bss_param->cap_info) & 0xFF;
> 5e18dd82 Ajay Singh 2018-01-22 1031 *(cur_byte++) = ((bss_param->cap_info) >> 8) & 0xFF;
> c5c77ba1 Johnny Kim 2015-05-11 1032
> 3891285c Ajay Singh 2018-01-22 1033 if (attr->bssid)
> 3891285c Ajay Singh 2018-01-22 1034 memcpy(cur_byte, attr->bssid, 6);
> 44ea7461 Ajay Singh 2018-01-22 1035 cur_byte += 6;
> c5c77ba1 Johnny Kim 2015-05-11 1036
> 3891285c Ajay Singh 2018-01-22 1037 if (attr->bssid)
> 3891285c Ajay Singh 2018-01-22 1038 memcpy(cur_byte, attr->bssid, 6);
> 44ea7461 Ajay Singh 2018-01-22 1039 cur_byte += 6;
> c0f52fba Tony Cho 2015-10-20 1040
> 5e18dd82 Ajay Singh 2018-01-22 1041 *(cur_byte++) = (bss_param->beacon_period) & 0xFF;
> 5e18dd82 Ajay Singh 2018-01-22 1042 *(cur_byte++) = ((bss_param->beacon_period) >> 8) & 0xFF;
> 5e18dd82 Ajay Singh 2018-01-22 1043 *(cur_byte++) = bss_param->dtim_period;
> ae4dfa57 Leo Kim 2015-10-13 1044
> 5e18dd82 Ajay Singh 2018-01-22 1045 memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1);
> 44ea7461 Ajay Singh 2018-01-22 1046 cur_byte += (MAX_RATES_SUPPORTED + 1);
> c5c77ba1 Johnny Kim 2015-05-11 1047
> 5e18dd82 Ajay Singh 2018-01-22 1048 *(cur_byte++) = bss_param->wmm_cap;
> 5e18dd82 Ajay Singh 2018-01-22 1049 *(cur_byte++) = bss_param->uapsd_cap;
> c5c77ba1 Johnny Kim 2015-05-11 1050
> 5e18dd82 Ajay Singh 2018-01-22 1051 *(cur_byte++) = bss_param->ht_capable;
> 5e18dd82 Ajay Singh 2018-01-22 1052 hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable;
> c5c77ba1 Johnny Kim 2015-05-11 1053
> 5e18dd82 Ajay Singh 2018-01-22 1054 *(cur_byte++) = bss_param->rsn_found;
> 5e18dd82 Ajay Singh 2018-01-22 1055 *(cur_byte++) = bss_param->rsn_grp_policy;
> 5e18dd82 Ajay Singh 2018-01-22 1056 *(cur_byte++) = bss_param->mode_802_11i;
> ae4dfa57 Leo Kim 2015-10-13 1057
> 5e18dd82 Ajay Singh 2018-01-22 1058 memcpy(cur_byte, bss_param->rsn_pcip_policy, sizeof(bss_param->rsn_pcip_policy));
> 5e18dd82 Ajay Singh 2018-01-22 1059 cur_byte += sizeof(bss_param->rsn_pcip_policy);
> c5c77ba1 Johnny Kim 2015-05-11 1060
> 5e18dd82 Ajay Singh 2018-01-22 1061 memcpy(cur_byte, bss_param->rsn_auth_policy, sizeof(bss_param->rsn_auth_policy));
> 5e18dd82 Ajay Singh 2018-01-22 1062 cur_byte += sizeof(bss_param->rsn_auth_policy);
> c5c77ba1 Johnny Kim 2015-05-11 1063
> 5e18dd82 Ajay Singh 2018-01-22 1064 memcpy(cur_byte, bss_param->rsn_cap, sizeof(bss_param->rsn_cap));
> 5e18dd82 Ajay Singh 2018-01-22 1065 cur_byte += sizeof(bss_param->rsn_cap);
> c5c77ba1 Johnny Kim 2015-05-11 1066
> 44ea7461 Ajay Singh 2018-01-22 1067 *(cur_byte++) = REAL_JOIN_REQ;
> 5e18dd82 Ajay Singh 2018-01-22 1068 *(cur_byte++) = bss_param->noa_enabled;
> c5c77ba1 Johnny Kim 2015-05-11 1069
> 5e18dd82 Ajay Singh 2018-01-22 1070 if (bss_param->noa_enabled) {
> 5e18dd82 Ajay Singh 2018-01-22 1071 *(cur_byte++) = (bss_param->tsf) & 0xFF;
> 5e18dd82 Ajay Singh 2018-01-22 1072 *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF;
> 5e18dd82 Ajay Singh 2018-01-22 1073 *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF;
> 5e18dd82 Ajay Singh 2018-01-22 1074 *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF;
> c5c77ba1 Johnny Kim 2015-05-11 1075
> 5e18dd82 Ajay Singh 2018-01-22 1076 *(cur_byte++) = bss_param->opp_enabled;
> 5e18dd82 Ajay Singh 2018-01-22 1077 *(cur_byte++) = bss_param->idx;
> c5c77ba1 Johnny Kim 2015-05-11 1078
> 5e18dd82 Ajay Singh 2018-01-22 1079 if (bss_param->opp_enabled)
> 5e18dd82 Ajay Singh 2018-01-22 1080 *(cur_byte++) = bss_param->ct_window;
> c5c77ba1 Johnny Kim 2015-05-11 1081
> 5e18dd82 Ajay Singh 2018-01-22 1082 *(cur_byte++) = bss_param->cnt;
> c5c77ba1 Johnny Kim 2015-05-11 1083
> 5e18dd82 Ajay Singh 2018-01-22 1084 memcpy(cur_byte, bss_param->duration, sizeof(bss_param->duration));
> 5e18dd82 Ajay Singh 2018-01-22 1085 cur_byte += sizeof(bss_param->duration);
> c5c77ba1 Johnny Kim 2015-05-11 1086
> 5e18dd82 Ajay Singh 2018-01-22 1087 memcpy(cur_byte, bss_param->interval, sizeof(bss_param->interval));
> 5e18dd82 Ajay Singh 2018-01-22 1088 cur_byte += sizeof(bss_param->interval);
> c5c77ba1 Johnny Kim 2015-05-11 1089
> 5e18dd82 Ajay Singh 2018-01-22 1090 memcpy(cur_byte, bss_param->start_time, sizeof(bss_param->start_time));
> 5e18dd82 Ajay Singh 2018-01-22 1091 cur_byte += sizeof(bss_param->start_time);
> c4f97526 Chris Park 2016-02-04 1092 }
> c5c77ba1 Johnny Kim 2015-05-11 1093
> 44ea7461 Ajay Singh 2018-01-22 1094 cur_byte = wid_list[wid_cnt].val;
> 7046f41b Ajay Singh 2018-01-22 1095 wid_cnt++;
> c5c77ba1 Johnny Kim 2015-05-11 1096
> 3891285c Ajay Singh 2018-01-22 1097 if (memcmp("DIRECT-", attr->ssid, 7)) {
> 44ea7461 Ajay Singh 2018-01-22 1098 memcpy(join_req, cur_byte, join_req_size);
> 7036c624 Glen Lee 2015-12-21 1099 join_req_vif = vif;
> c5c77ba1 Johnny Kim 2015-05-11 1100 }
> c5c77ba1 Johnny Kim 2015-05-11 1101
> 3891285c Ajay Singh 2018-01-22 1102 if (attr->bssid)
> 3891285c Ajay Singh 2018-01-22 1103 memcpy(wilc_connected_ssid,attr->bssid, ETH_ALEN);
> c5c77ba1 Johnny Kim 2015-05-11 1104
> 5a99cdf9 Ajay Singh 2018-01-22 1105 result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
> 7046f41b Ajay Singh 2018-01-22 1106 wid_cnt,
> eb9939b7 Glen Lee 2015-12-21 1107 wilc_get_vif_idx(vif));
> 31390eec Leo Kim 2015-10-19 1108 if (result) {
> b92f9304 Chris Park 2016-02-22 1109 netdev_err(vif->ndev, "failed to send config packet\n");
> 31390eec Leo Kim 2015-10-19 1110 result = -EFAULT;
> 24db713f Leo Kim 2015-09-16 1111 goto ERRORHANDLER;
> c5c77ba1 Johnny Kim 2015-05-11 1112 } else {
> b60005a8 Leo Kim 2015-10-29 1113 hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP;
> c5c77ba1 Johnny Kim 2015-05-11 1114 }
> c5c77ba1 Johnny Kim 2015-05-11 1115
> 24db713f Leo Kim 2015-09-16 1116 ERRORHANDLER:
> 31390eec Leo Kim 2015-10-19 1117 if (result) {
> 6a247004 Ajay Singh 2018-01-22 1118 struct connect_info conn_info;
> c5c77ba1 Johnny Kim 2015-05-11 1119
> 81a59506 Leo Kim 2015-10-29 1120 del_timer(&hif_drv->connect_timer);
> c5c77ba1 Johnny Kim 2015-05-11 1121
> 6a247004 Ajay Singh 2018-01-22 1122 memset(&conn_info, 0, sizeof(struct connect_info));
> c5c77ba1 Johnny Kim 2015-05-11 1123
> 3891285c Ajay Singh 2018-01-22 1124 if (attr->result) {
> 3891285c Ajay Singh 2018-01-22 1125 if (attr->bssid)
> 6a247004 Ajay Singh 2018-01-22 1126 memcpy(conn_info.bssid, attr->bssid, 6);
> c5c77ba1 Johnny Kim 2015-05-11 1127
> 3891285c Ajay Singh 2018-01-22 1128 if (attr->ies) {
> 6a247004 Ajay Singh 2018-01-22 1129 conn_info.req_ies_len = attr->ies_len;
> 6a247004 Ajay Singh 2018-01-22 1130 conn_info.req_ies = kmalloc(attr->ies_len, GFP_KERNEL);
> 6a247004 Ajay Singh 2018-01-22 1131 memcpy(conn_info.req_ies, attr->ies, attr->ies_len);
> c5c77ba1 Johnny Kim 2015-05-11 1132 }
> c5c77ba1 Johnny Kim 2015-05-11 1133
> 3891285c Ajay Singh 2018-01-22 1134 attr->result(CONN_DISCONN_EVENT_CONN_RESP,
> 6a247004 Ajay Singh 2018-01-22 1135 &conn_info,
> c5c77ba1 Johnny Kim 2015-05-11 1136 MAC_DISCONNECTED,
> c5c77ba1 Johnny Kim 2015-05-11 1137 NULL,
> 3891285c Ajay Singh 2018-01-22 1138 attr->arg);
> b60005a8 Leo Kim 2015-10-29 1139 hif_drv->hif_state = HOST_IF_IDLE;
> 6a247004 Ajay Singh 2018-01-22 1140 kfree(conn_info.req_ies);
> 6a247004 Ajay Singh 2018-01-22 1141 conn_info.req_ies = NULL;
> c5c77ba1 Johnny Kim 2015-05-11 1142
> c5c77ba1 Johnny Kim 2015-05-11 1143 } else {
> b92f9304 Chris Park 2016-02-22 1144 netdev_err(vif->ndev, "Connect callback is NULL\n");
> c5c77ba1 Johnny Kim 2015-05-11 1145 }
> c5c77ba1 Johnny Kim 2015-05-11 1146 }
> c5c77ba1 Johnny Kim 2015-05-11 1147
> 3891285c Ajay Singh 2018-01-22 1148 kfree(attr->bssid);
> 3891285c Ajay Singh 2018-01-22 1149 attr->bssid = NULL;
> c5c77ba1 Johnny Kim 2015-05-11 1150
> 3891285c Ajay Singh 2018-01-22 1151 kfree(attr->ssid);
> 3891285c Ajay Singh 2018-01-22 1152 attr->ssid = NULL;
> c5c77ba1 Johnny Kim 2015-05-11 1153
> 3891285c Ajay Singh 2018-01-22 1154 kfree(attr->ies);
> 3891285c Ajay Singh 2018-01-22 1155 attr->ies = NULL;
> c5c77ba1 Johnny Kim 2015-05-11 1156
> 44ea7461 Ajay Singh 2018-01-22 1157 kfree(cur_byte);
> 31390eec Leo Kim 2015-10-19 1158 return result;
> c5c77ba1 Johnny Kim 2015-05-11 1159 }
> c5c77ba1 Johnny Kim 2015-05-11 1160
>
> :::::: The code at line 937 was first introduced by commit
> :::::: 3891285c9a8a05a4789a3c286d7f9bdbde6b23c7 staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid camelCase


The patch only change variable names to avoid the camelCase, didn't modify any extra code to dereference memory.
I think, with the use of shorter variable name now memcpy() is taking 1 line instead of 3 lines. So, now line 937 has different code line(as code is swifted up by few lines).So because of that new potential NULL dereference error is popped up for same existing code.
The code to validate dynamically allocated memory before access, will be include in separate patch to keep it segregated from variable names changes.
I will rework on this patch and resend again.


>
> :::::: TO: Ajay Singh <[email protected]>
> :::::: CC: 0day robot <[email protected]>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation

2018-01-22 11:15:06

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase



On 22.01.2018 13:10, Claudiu Beznea wrote:
>
>
> On 22.01.2018 12:22, Ajay Singh wrote:
>> This patch series contains changes to fix issues reported by checkpatch.pl script.
>>
>> Changes since v1:
>> * Patch0004: Used "host_int_parse_join_bss_param" for function name.
>> * Patch0009: Put memcpy statement in single line instead of using two lines.
>> * Patch0010: Used "bss_param" for variable name instead of j_bss_param.
>> * Added "Reviewed-by: Claudiu Beznea <[email protected]>" for commit description.
>> * Modify the commit description to start with capital letter for all patch.
> You forgot to do it for patches 3 and 8.
Also, for 7.
>>
>>
>> Ajay Singh (14):
>> staging: wilc1000: remove unnecessary use of parentheses
>> staging: wilc1000: removed unnecessary defined enums typedef
>> staging: wilc1000: fix alignments to match open parenthesis
>> staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
>> variable using camelCase
>> staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
>> variable
>> staging: wilc1000: rename strWIDList variable to wid_list to avoid
>> camelCase
>> staging: wilc1000: rename u32WidsCount variable to avoid camelCase
>> staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
>> staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
>> camelCase
>> staging: wilc1000: rename ptstrJoinBssParam variable to avoid
>> camelCase
>> staging: wilc1000: rename strConnectInfo variable to avoid camelCase
>> staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
>> staging: wilc1000: rename Handle_Connect() to avoid camelCase
>> staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()
>>
>> drivers/staging/wilc1000/coreconfigurator.c | 2 +-
>> drivers/staging/wilc1000/host_interface.c | 937 +++++++++++-----------
>> drivers/staging/wilc1000/linux_wlan.c | 10 +-
>> drivers/staging/wilc1000/wilc_sdio.c | 4 +-
>> drivers/staging/wilc1000/wilc_spi.c | 20 +-
>> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 64 +-
>> drivers/staging/wilc1000/wilc_wlan.c | 2 +-
>> drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +-
>> drivers/staging/wilc1000/wilc_wlan_if.h | 72 +-
>> 9 files changed, 555 insertions(+), 562 deletions(-)
>>

2018-01-22 10:23:28

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 11/14] staging: wilc1000: rename strConnectInfo variable to avoid camelCase

Fix "Avoid camelCase" issue reported by checkpatch.pl script.
In this patch rename "strConnectInfo" variable to resolve
issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 74 +++++++++++++++----------------
1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index c3b6368..0eaf6c6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1115,30 +1115,30 @@ static s32 Handle_Connect(struct wilc_vif *vif,

ERRORHANDLER:
if (result) {
- struct connect_info strConnectInfo;
+ struct connect_info conn_info;

del_timer(&hif_drv->connect_timer);

- memset(&strConnectInfo, 0, sizeof(struct connect_info));
+ memset(&conn_info, 0, sizeof(struct connect_info));

if (attr->result) {
if (attr->bssid)
- memcpy(strConnectInfo.bssid, attr->bssid, 6);
+ memcpy(conn_info.bssid, attr->bssid, 6);

if (attr->ies) {
- strConnectInfo.req_ies_len = attr->ies_len;
- strConnectInfo.req_ies = kmalloc(attr->ies_len, GFP_KERNEL);
- memcpy(strConnectInfo.req_ies, attr->ies, attr->ies_len);
+ conn_info.req_ies_len = attr->ies_len;
+ conn_info.req_ies = kmalloc(attr->ies_len, GFP_KERNEL);
+ memcpy(conn_info.req_ies, attr->ies, attr->ies_len);
}

attr->result(CONN_DISCONN_EVENT_CONN_RESP,
- &strConnectInfo,
+ &conn_info,
MAC_DISCONNECTED,
NULL,
attr->arg);
hif_drv->hif_state = HOST_IF_IDLE;
- kfree(strConnectInfo.req_ies);
- strConnectInfo.req_ies = NULL;
+ kfree(conn_info.req_ies);
+ conn_info.req_ies = NULL;

} else {
netdev_err(vif->ndev, "Connect callback is NULL\n");
@@ -1161,7 +1161,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
{
s32 result = 0;
- struct connect_info strConnectInfo;
+ struct connect_info conn_info;
struct wid wid;
u16 u16DummyReasonCode = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1175,30 +1175,30 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)

scan_while_connected = false;

- memset(&strConnectInfo, 0, sizeof(struct connect_info));
+ memset(&conn_info, 0, sizeof(struct connect_info));

if (hif_drv->usr_conn_req.conn_result) {
if (hif_drv->usr_conn_req.bssid) {
- memcpy(strConnectInfo.bssid,
+ memcpy(conn_info.bssid,
hif_drv->usr_conn_req.bssid, 6);
}

if (hif_drv->usr_conn_req.ies) {
- strConnectInfo.req_ies_len = hif_drv->usr_conn_req.ies_len;
- strConnectInfo.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
- memcpy(strConnectInfo.req_ies,
+ conn_info.req_ies_len = hif_drv->usr_conn_req.ies_len;
+ conn_info.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
+ memcpy(conn_info.req_ies,
hif_drv->usr_conn_req.ies,
hif_drv->usr_conn_req.ies_len);
}

hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
- &strConnectInfo,
+ &conn_info,
MAC_DISCONNECTED,
NULL,
hif_drv->usr_conn_req.arg);

- kfree(strConnectInfo.req_ies);
- strConnectInfo.req_ies = NULL;
+ kfree(conn_info.req_ies);
+ conn_info.req_ies = NULL;
} else {
netdev_err(vif->ndev, "Connect callback is NULL\n");
}
@@ -1323,7 +1323,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
u8 u8MacStatus;
u8 u8MacStatusReasonCode;
u8 u8MacStatusAdditionalInfo;
- struct connect_info strConnectInfo;
+ struct connect_info conn_info;
struct disconnect_info strDisconnectNotifInfo;
s32 s32Err = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1360,7 +1360,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
u32 u32RcvdAssocRespInfoLen = 0;
struct connect_resp_info *pstrConnectRespInfo = NULL;

- memset(&strConnectInfo, 0, sizeof(struct connect_info));
+ memset(&conn_info, 0, sizeof(struct connect_info));

if (u8MacStatus == MAC_CONNECTED) {
memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
@@ -1376,12 +1376,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
if (s32Err) {
netdev_err(vif->ndev, "wilc_parse_assoc_resp_info() returned error %d\n", s32Err);
} else {
- strConnectInfo.status = pstrConnectRespInfo->status;
+ conn_info.status = pstrConnectRespInfo->status;

- if (strConnectInfo.status == SUCCESSFUL_STATUSCODE && pstrConnectRespInfo->ies) {
- strConnectInfo.resp_ies_len = pstrConnectRespInfo->ies_len;
- strConnectInfo.resp_ies = kmalloc(pstrConnectRespInfo->ies_len, GFP_KERNEL);
- memcpy(strConnectInfo.resp_ies, pstrConnectRespInfo->ies,
+ if (conn_info.status == SUCCESSFUL_STATUSCODE && pstrConnectRespInfo->ies) {
+ conn_info.resp_ies_len = pstrConnectRespInfo->ies_len;
+ conn_info.resp_ies = kmalloc(pstrConnectRespInfo->ies_len, GFP_KERNEL);
+ memcpy(conn_info.resp_ies, pstrConnectRespInfo->ies,
pstrConnectRespInfo->ies_len);
}

@@ -1394,7 +1394,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
}

if (u8MacStatus == MAC_CONNECTED &&
- strConnectInfo.status != SUCCESSFUL_STATUSCODE) {
+ conn_info.status != SUCCESSFUL_STATUSCODE) {
netdev_err(vif->ndev, "Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
eth_zero_addr(wilc_connected_ssid);
} else if (u8MacStatus == MAC_DISCONNECTED) {
@@ -1403,32 +1403,32 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
}

if (hif_drv->usr_conn_req.bssid) {
- memcpy(strConnectInfo.bssid, hif_drv->usr_conn_req.bssid, 6);
+ memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);

if (u8MacStatus == MAC_CONNECTED &&
- strConnectInfo.status == SUCCESSFUL_STATUSCODE) {
+ conn_info.status == SUCCESSFUL_STATUSCODE) {
memcpy(hif_drv->assoc_bssid,
hif_drv->usr_conn_req.bssid, ETH_ALEN);
}
}

if (hif_drv->usr_conn_req.ies) {
- strConnectInfo.req_ies_len = hif_drv->usr_conn_req.ies_len;
- strConnectInfo.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
- memcpy(strConnectInfo.req_ies,
+ conn_info.req_ies_len = hif_drv->usr_conn_req.ies_len;
+ conn_info.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
+ memcpy(conn_info.req_ies,
hif_drv->usr_conn_req.ies,
hif_drv->usr_conn_req.ies_len);
}

del_timer(&hif_drv->connect_timer);
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
- &strConnectInfo,
+ &conn_info,
u8MacStatus,
NULL,
hif_drv->usr_conn_req.arg);

if (u8MacStatus == MAC_CONNECTED &&
- strConnectInfo.status == SUCCESSFUL_STATUSCODE) {
+ conn_info.status == SUCCESSFUL_STATUSCODE) {
wilc_set_power_mgmt(vif, 0, 0);

hif_drv->hif_state = HOST_IF_CONNECTED;
@@ -1441,11 +1441,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
scan_while_connected = false;
}

- kfree(strConnectInfo.resp_ies);
- strConnectInfo.resp_ies = NULL;
+ kfree(conn_info.resp_ies);
+ conn_info.resp_ies = NULL;

- kfree(strConnectInfo.req_ies);
- strConnectInfo.req_ies = NULL;
+ kfree(conn_info.req_ies);
+ conn_info.req_ies = NULL;
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.ssid);
hif_drv->usr_conn_req.ssid = NULL;
--
2.7.4

2018-01-22 10:23:03

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 03/14] staging: wilc1000: fix alignments to match open parenthesis

Fix "Alignment should match open parenthesis" issues reported by
checkpatch.pl script. changes to comply with linux coding style.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 4 +--
drivers/staging/wilc1000/linux_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 38 +++++++++++------------
3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 46e2d55..358354b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3730,8 +3730,8 @@ int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param)
memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
if (add_sta_info->rates_len > 0) {
add_sta_info->rates = kmemdup(sta_param->rates,
- add_sta_info->rates_len,
- GFP_KERNEL);
+ add_sta_info->rates_len,
+ GFP_KERNEL);
if (!add_sta_info->rates)
return -ENOMEM;
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 3c3f1863..d9725ef 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -695,7 +695,7 @@ static int wlan_initialize_threads(struct net_device *dev)
wilc = vif->wilc;

wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
- "K_TXQ_TASK");
+ "K_TXQ_TASK");
if (IS_ERR(wilc->txq_thread)) {
netdev_err(dev, "couldn't create TXQ thread\n");
wilc->close = 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index fb4a142..621810d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -470,10 +470,10 @@ static void CfgScanResult(enum scan_event scan_event,
int wilc_connecting;

static void cfg_connect_result(enum conn_event conn_disconn_evt,
- struct connect_info *conn_info,
- u8 mac_status,
- struct disconnect_info *disconn_info,
- void *priv_data)
+ struct connect_info *conn_info,
+ u8 mac_status,
+ struct disconnect_info *disconn_info,
+ void *priv_data)
{
struct wilc_priv *priv;
struct net_device *dev;
@@ -623,18 +623,18 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
}
}
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
- au8ScanChanList,
- request->n_channels,
- (const u8 *)request->ie,
- request->ie_len, CfgScanResult,
- (void *)priv, &strHiddenNetwork);
+ au8ScanChanList,
+ request->n_channels,
+ (const u8 *)request->ie,
+ request->ie_len, CfgScanResult,
+ (void *)priv, &strHiddenNetwork);
} else {
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
- au8ScanChanList,
- request->n_channels,
- (const u8 *)request->ie,
- request->ie_len, CfgScanResult,
- (void *)priv, NULL);
+ au8ScanChanList,
+ request->n_channels,
+ (const u8 *)request->ie,
+ request->ie_len, CfgScanResult,
+ (void *)priv, NULL);
}
} else {
netdev_err(priv->dev, "Requested scanned channels over\n");
@@ -793,11 +793,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
wilc_wlan_set_bssid(dev, pstrNetworkInfo->bssid, STATION_MODE);

ret = wilc_set_join_req(vif, pstrNetworkInfo->bssid, sme->ssid,
- sme->ssid_len, sme->ie, sme->ie_len,
- cfg_connect_result, (void *)priv,
- u8security, auth_type,
- pstrNetworkInfo->ch,
- pstrNetworkInfo->join_params);
+ sme->ssid_len, sme->ie, sme->ie_len,
+ cfg_connect_result, (void *)priv,
+ u8security, auth_type,
+ pstrNetworkInfo->ch,
+ pstrNetworkInfo->join_params);
if (ret != 0) {
netdev_err(dev, "wilc_set_join_req(): Error\n");
ret = -ENOENT;
--
2.7.4

2018-01-30 14:40:58

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

On Tue, Jan 30, 2018 at 07:29:49PM +0530, Ajay Singh wrote:
> On Tue, 30 Jan 2018 02:13:53 +0800
> kbuild test robot <[email protected]> wrote:
>

>
>
> The patch only change variable names to avoid the camelCase, didn't modify any extra code to dereference memory.

You are responding to a robot and I think we all understood that this
warning was there before you renamed the variables.

> I think, with the use of shorter variable name now memcpy() is taking 1 line instead of 3 lines. So, now line 937 has different code line(as code is swifted up by few lines).So because of that new potential NULL dereference error is popped up for same existing code.
> The code to validate dynamically allocated memory before access, will be include in separate patch to keep it segregated from variable names changes.
> I will rework on this patch and resend again.

There is no need to re-work the patch.

You are right that the NULL check should be added as a separate check.

regards,
dan carpenter

2018-01-22 11:13:07

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 04/14] staging: wilc1000: rename host_int_ParseJoinBssParam() and it's variable using camelCase



On 22.01.2018 12:22, Ajay Singh wrote:
> Fix "Avoid CamelCase:" issue reported by checkpatch.pl script
Forgot a dot here?
> Rename host_int_ParseJoinBssParam() & its variables name using
> camelCase.
>
> Signed-off-by: Ajay Singh <[email protected]>
> Reviewed-by: Claudiu Beznea <[email protected]>
> ---
> drivers/staging/wilc1000/host_interface.c | 230 +++++++++++++++---------------
> 1 file changed, 115 insertions(+), 115 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 358354b..8f8e727 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -265,7 +265,7 @@ static struct wilc_vif *join_req_vif;
> #define FLUSHED_JOIN_REQ 1
> #define FLUSHED_BYTE_POS 79
>
> -static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo);
> +static void *host_int_parse_join_bss_param(struct network_info *info);
> static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
> static s32 Handle_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
> static void host_if_work(struct work_struct *work);
> @@ -1288,7 +1288,7 @@ static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,
> hif_drv->usr_scan_req.rcvd_ch_cnt++;
>
> pstrNetworkInfo->new_network = true;
> - pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo);
> + pJoinParams = host_int_parse_join_bss_param(pstrNetworkInfo);
>
> hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
> hif_drv->usr_scan_req.arg,
> @@ -3870,152 +3870,152 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
> return result;
> }
>
> -static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
> +static void *host_int_parse_join_bss_param(struct network_info *info)
> {
> - struct join_bss_param *pNewJoinBssParam = NULL;
> - u8 *pu8IEs;
> - u16 u16IEsLen;
> + struct join_bss_param *param = NULL;
> + u8 *ies;
> + u16 ies_len;
> u16 index = 0;
> - u8 suppRatesNo = 0;
> - u8 extSuppRatesNo;
> - u16 jumpOffset;
> - u8 pcipherCount;
> - u8 authCount;
> - u8 pcipherTotalCount = 0;
> - u8 authTotalCount = 0;
> + u8 rates_no = 0;
> + u8 ext_rates_no;
> + u16 offset;
> + u8 pcipher_cnt;
> + u8 auth_cnt;
> + u8 pcipher_total_cnt = 0;
> + u8 auth_total_cnt = 0;
> u8 i, j;
>
> - pu8IEs = ptstrNetworkInfo->ies;
> - u16IEsLen = ptstrNetworkInfo->ies_len;
> -
> - pNewJoinBssParam = kzalloc(sizeof(*pNewJoinBssParam), GFP_KERNEL);
> - if (pNewJoinBssParam) {
> - pNewJoinBssParam->dtim_period = ptstrNetworkInfo->dtim_period;
> - pNewJoinBssParam->beacon_period = ptstrNetworkInfo->beacon_period;
> - pNewJoinBssParam->cap_info = ptstrNetworkInfo->cap_info;
> - memcpy(pNewJoinBssParam->bssid, ptstrNetworkInfo->bssid, 6);
> - memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->ssid,
> - ptstrNetworkInfo->ssid_len + 1);
> - pNewJoinBssParam->ssid_len = ptstrNetworkInfo->ssid_len;
> - memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3);
> - memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3);
> -
> - while (index < u16IEsLen) {
> - if (pu8IEs[index] == SUPP_RATES_IE) {
> - suppRatesNo = pu8IEs[index + 1];
> - pNewJoinBssParam->supp_rates[0] = suppRatesNo;
> + ies = info->ies;
> + ies_len = info->ies_len;
> +
> + param = kzalloc(sizeof(*param), GFP_KERNEL);
> + if (param) {
> + param->dtim_period = info->dtim_period;
> + param->beacon_period = info->beacon_period;
> + param->cap_info = info->cap_info;
> + memcpy(param->bssid, info->bssid, 6);
> + memcpy((u8 *)param->ssid, info->ssid,
> + info->ssid_len + 1);
> + param->ssid_len = info->ssid_len;
> + memset(param->rsn_pcip_policy, 0xFF, 3);
> + memset(param->rsn_auth_policy, 0xFF, 3);
> +
> + while (index < ies_len) {
> + if (ies[index] == SUPP_RATES_IE) {
> + rates_no = ies[index + 1];
> + param->supp_rates[0] = rates_no;
> index += 2;
>
> - for (i = 0; i < suppRatesNo; i++)
> - pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
> + for (i = 0; i < rates_no; i++)
> + param->supp_rates[i + 1] = ies[index + i];
>
> - index += suppRatesNo;
> - } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
> - extSuppRatesNo = pu8IEs[index + 1];
> - if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
> - pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED;
> + index += rates_no;
> + } else if (ies[index] == EXT_SUPP_RATES_IE) {
> + ext_rates_no = ies[index + 1];
> + if (ext_rates_no > (MAX_RATES_SUPPORTED - rates_no))
> + param->supp_rates[0] = MAX_RATES_SUPPORTED;
> else
> - pNewJoinBssParam->supp_rates[0] += extSuppRatesNo;
> + param->supp_rates[0] += ext_rates_no;
> index += 2;
> - for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++)
> - pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
> -
> - index += extSuppRatesNo;
> - } else if (pu8IEs[index] == HT_CAPABILITY_IE) {
> - pNewJoinBssParam->ht_capable = true;
> - index += pu8IEs[index + 1] + 2;
> - } else if ((pu8IEs[index] == WMM_IE) &&
> - (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
> - (pu8IEs[index + 4] == 0xF2) &&
> - (pu8IEs[index + 5] == 0x02) &&
> - ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) &&
> - (pu8IEs[index + 7] == 0x01)) {
> - pNewJoinBssParam->wmm_cap = true;
> -
> - if (pu8IEs[index + 8] & BIT(7))
> - pNewJoinBssParam->uapsd_cap = true;
> - index += pu8IEs[index + 1] + 2;
> - } else if ((pu8IEs[index] == P2P_IE) &&
> - (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
> - (pu8IEs[index + 4] == 0x9a) &&
> - (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) {
> - u16 u16P2P_count;
> -
> - pNewJoinBssParam->tsf = ptstrNetworkInfo->tsf_lo;
> - pNewJoinBssParam->noa_enabled = 1;
> - pNewJoinBssParam->idx = pu8IEs[index + 9];
> -
> - if (pu8IEs[index + 10] & BIT(7)) {
> - pNewJoinBssParam->opp_enabled = 1;
> - pNewJoinBssParam->ct_window = pu8IEs[index + 10];
> + for (i = 0; i < (param->supp_rates[0] - rates_no); i++)
> + param->supp_rates[rates_no + i + 1] = ies[index + i];
> +
> + index += ext_rates_no;
> + } else if (ies[index] == HT_CAPABILITY_IE) {
> + param->ht_capable = true;
> + index += ies[index + 1] + 2;
> + } else if ((ies[index] == WMM_IE) &&
> + (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
> + (ies[index + 4] == 0xF2) &&
> + (ies[index + 5] == 0x02) &&
> + ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
> + (ies[index + 7] == 0x01)) {
> + param->wmm_cap = true;
> +
> + if (ies[index + 8] & BIT(7))
> + param->uapsd_cap = true;
> + index += ies[index + 1] + 2;
> + } else if ((ies[index] == P2P_IE) &&
> + (ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
> + (ies[index + 4] == 0x9a) &&
> + (ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
> + u16 p2p_cnt;
> +
> + param->tsf = info->tsf_lo;
> + param->noa_enabled = 1;
> + param->idx = ies[index + 9];
> +
> + if (ies[index + 10] & BIT(7)) {
> + param->opp_enabled = 1;
> + param->ct_window = ies[index + 10];
> } else {
> - pNewJoinBssParam->opp_enabled = 0;
> + param->opp_enabled = 0;
> }
>
> - pNewJoinBssParam->cnt = pu8IEs[index + 11];
> - u16P2P_count = index + 12;
> + param->cnt = ies[index + 11];
> + p2p_cnt = index + 12;
>
> - memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4);
> - u16P2P_count += 4;
> + memcpy(param->duration, ies + p2p_cnt, 4);
> + p2p_cnt += 4;
>
> - memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4);
> - u16P2P_count += 4;
> + memcpy(param->interval, ies + p2p_cnt, 4);
> + p2p_cnt += 4;
>
> - memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4);
> + memcpy(param->start_time, ies + p2p_cnt, 4);
>
> - index += pu8IEs[index + 1] + 2;
> - } else if ((pu8IEs[index] == RSN_IE) ||
> - ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
> - (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
> - (pu8IEs[index + 5] == 0x01))) {
> - u16 rsnIndex = index;
> + index += ies[index + 1] + 2;
> + } else if ((ies[index] == RSN_IE) ||
> + ((ies[index] == WPA_IE) && (ies[index + 2] == 0x00) &&
> + (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
> + (ies[index + 5] == 0x01))) {
> + u16 rsn_idx = index;
>
> - if (pu8IEs[rsnIndex] == RSN_IE) {
> - pNewJoinBssParam->mode_802_11i = 2;
> + if (ies[rsn_idx] == RSN_IE) {
> + param->mode_802_11i = 2;
> } else {
> - if (pNewJoinBssParam->mode_802_11i == 0)
> - pNewJoinBssParam->mode_802_11i = 1;
> - rsnIndex += 4;
> + if (param->mode_802_11i == 0)
> + param->mode_802_11i = 1;
> + rsn_idx += 4;
> }
>
> - rsnIndex += 7;
> - pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex];
> - rsnIndex++;
> - jumpOffset = pu8IEs[rsnIndex] * 4;
> - pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
> - rsnIndex += 2;
> + rsn_idx += 7;
> + param->rsn_grp_policy = ies[rsn_idx];
> + rsn_idx++;
> + offset = ies[rsn_idx] * 4;
> + pcipher_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
> + rsn_idx += 2;
>
> - for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++)
> - pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
> + for (i = pcipher_total_cnt, j = 0; i < pcipher_cnt + pcipher_total_cnt && i < 3; i++, j++)
> + param->rsn_pcip_policy[i] = ies[rsn_idx + ((j + 1) * 4) - 1];
>
> - pcipherTotalCount += pcipherCount;
> - rsnIndex += jumpOffset;
> + pcipher_total_cnt += pcipher_cnt;
> + rsn_idx += offset;
>
> - jumpOffset = pu8IEs[rsnIndex] * 4;
> + offset = ies[rsn_idx] * 4;
>
> - authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
> - rsnIndex += 2;
> + auth_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
> + rsn_idx += 2;
>
> - for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++)
> - pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
> + for (i = auth_total_cnt, j = 0; i < auth_total_cnt + auth_cnt; i++, j++)
> + param->rsn_auth_policy[i] = ies[rsn_idx + ((j + 1) * 4) - 1];
>
> - authTotalCount += authCount;
> - rsnIndex += jumpOffset;
> + auth_total_cnt += auth_cnt;
> + rsn_idx += offset;
>
> - if (pu8IEs[index] == RSN_IE) {
> - pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex];
> - pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1];
> - rsnIndex += 2;
> + if (ies[index] == RSN_IE) {
> + param->rsn_cap[0] = ies[rsn_idx];
> + param->rsn_cap[1] = ies[rsn_idx + 1];
> + rsn_idx += 2;
> }
> - pNewJoinBssParam->rsn_found = true;
> - index += pu8IEs[index + 1] + 2;
> + param->rsn_found = true;
> + index += ies[index + 1] + 2;
> } else {
> - index += pu8IEs[index + 1] + 2;
> + index += ies[index + 1] + 2;
> }
> }
> }
>
> - return (void *)pNewJoinBssParam;
> + return (void *)param;
> }
>
> int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
>

2018-01-22 10:23:06

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 04/14] staging: wilc1000: rename host_int_ParseJoinBssParam() and it's variable using camelCase

Fix "Avoid CamelCase:" issue reported by checkpatch.pl script
Rename host_int_ParseJoinBssParam() & its variables name using
camelCase.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 230 +++++++++++++++---------------
1 file changed, 115 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 358354b..8f8e727 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -265,7 +265,7 @@ static struct wilc_vif *join_req_vif;
#define FLUSHED_JOIN_REQ 1
#define FLUSHED_BYTE_POS 79

-static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo);
+static void *host_int_parse_join_bss_param(struct network_info *info);
static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
static s32 Handle_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
static void host_if_work(struct work_struct *work);
@@ -1288,7 +1288,7 @@ static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,
hif_drv->usr_scan_req.rcvd_ch_cnt++;

pstrNetworkInfo->new_network = true;
- pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo);
+ pJoinParams = host_int_parse_join_bss_param(pstrNetworkInfo);

hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
hif_drv->usr_scan_req.arg,
@@ -3870,152 +3870,152 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
return result;
}

-static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
+static void *host_int_parse_join_bss_param(struct network_info *info)
{
- struct join_bss_param *pNewJoinBssParam = NULL;
- u8 *pu8IEs;
- u16 u16IEsLen;
+ struct join_bss_param *param = NULL;
+ u8 *ies;
+ u16 ies_len;
u16 index = 0;
- u8 suppRatesNo = 0;
- u8 extSuppRatesNo;
- u16 jumpOffset;
- u8 pcipherCount;
- u8 authCount;
- u8 pcipherTotalCount = 0;
- u8 authTotalCount = 0;
+ u8 rates_no = 0;
+ u8 ext_rates_no;
+ u16 offset;
+ u8 pcipher_cnt;
+ u8 auth_cnt;
+ u8 pcipher_total_cnt = 0;
+ u8 auth_total_cnt = 0;
u8 i, j;

- pu8IEs = ptstrNetworkInfo->ies;
- u16IEsLen = ptstrNetworkInfo->ies_len;
-
- pNewJoinBssParam = kzalloc(sizeof(*pNewJoinBssParam), GFP_KERNEL);
- if (pNewJoinBssParam) {
- pNewJoinBssParam->dtim_period = ptstrNetworkInfo->dtim_period;
- pNewJoinBssParam->beacon_period = ptstrNetworkInfo->beacon_period;
- pNewJoinBssParam->cap_info = ptstrNetworkInfo->cap_info;
- memcpy(pNewJoinBssParam->bssid, ptstrNetworkInfo->bssid, 6);
- memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->ssid,
- ptstrNetworkInfo->ssid_len + 1);
- pNewJoinBssParam->ssid_len = ptstrNetworkInfo->ssid_len;
- memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3);
- memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3);
-
- while (index < u16IEsLen) {
- if (pu8IEs[index] == SUPP_RATES_IE) {
- suppRatesNo = pu8IEs[index + 1];
- pNewJoinBssParam->supp_rates[0] = suppRatesNo;
+ ies = info->ies;
+ ies_len = info->ies_len;
+
+ param = kzalloc(sizeof(*param), GFP_KERNEL);
+ if (param) {
+ param->dtim_period = info->dtim_period;
+ param->beacon_period = info->beacon_period;
+ param->cap_info = info->cap_info;
+ memcpy(param->bssid, info->bssid, 6);
+ memcpy((u8 *)param->ssid, info->ssid,
+ info->ssid_len + 1);
+ param->ssid_len = info->ssid_len;
+ memset(param->rsn_pcip_policy, 0xFF, 3);
+ memset(param->rsn_auth_policy, 0xFF, 3);
+
+ while (index < ies_len) {
+ if (ies[index] == SUPP_RATES_IE) {
+ rates_no = ies[index + 1];
+ param->supp_rates[0] = rates_no;
index += 2;

- for (i = 0; i < suppRatesNo; i++)
- pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
+ for (i = 0; i < rates_no; i++)
+ param->supp_rates[i + 1] = ies[index + i];

- index += suppRatesNo;
- } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
- extSuppRatesNo = pu8IEs[index + 1];
- if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
- pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED;
+ index += rates_no;
+ } else if (ies[index] == EXT_SUPP_RATES_IE) {
+ ext_rates_no = ies[index + 1];
+ if (ext_rates_no > (MAX_RATES_SUPPORTED - rates_no))
+ param->supp_rates[0] = MAX_RATES_SUPPORTED;
else
- pNewJoinBssParam->supp_rates[0] += extSuppRatesNo;
+ param->supp_rates[0] += ext_rates_no;
index += 2;
- for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++)
- pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
-
- index += extSuppRatesNo;
- } else if (pu8IEs[index] == HT_CAPABILITY_IE) {
- pNewJoinBssParam->ht_capable = true;
- index += pu8IEs[index + 1] + 2;
- } else if ((pu8IEs[index] == WMM_IE) &&
- (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
- (pu8IEs[index + 4] == 0xF2) &&
- (pu8IEs[index + 5] == 0x02) &&
- ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) &&
- (pu8IEs[index + 7] == 0x01)) {
- pNewJoinBssParam->wmm_cap = true;
-
- if (pu8IEs[index + 8] & BIT(7))
- pNewJoinBssParam->uapsd_cap = true;
- index += pu8IEs[index + 1] + 2;
- } else if ((pu8IEs[index] == P2P_IE) &&
- (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
- (pu8IEs[index + 4] == 0x9a) &&
- (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) {
- u16 u16P2P_count;
-
- pNewJoinBssParam->tsf = ptstrNetworkInfo->tsf_lo;
- pNewJoinBssParam->noa_enabled = 1;
- pNewJoinBssParam->idx = pu8IEs[index + 9];
-
- if (pu8IEs[index + 10] & BIT(7)) {
- pNewJoinBssParam->opp_enabled = 1;
- pNewJoinBssParam->ct_window = pu8IEs[index + 10];
+ for (i = 0; i < (param->supp_rates[0] - rates_no); i++)
+ param->supp_rates[rates_no + i + 1] = ies[index + i];
+
+ index += ext_rates_no;
+ } else if (ies[index] == HT_CAPABILITY_IE) {
+ param->ht_capable = true;
+ index += ies[index + 1] + 2;
+ } else if ((ies[index] == WMM_IE) &&
+ (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
+ (ies[index + 4] == 0xF2) &&
+ (ies[index + 5] == 0x02) &&
+ ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
+ (ies[index + 7] == 0x01)) {
+ param->wmm_cap = true;
+
+ if (ies[index + 8] & BIT(7))
+ param->uapsd_cap = true;
+ index += ies[index + 1] + 2;
+ } else if ((ies[index] == P2P_IE) &&
+ (ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
+ (ies[index + 4] == 0x9a) &&
+ (ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
+ u16 p2p_cnt;
+
+ param->tsf = info->tsf_lo;
+ param->noa_enabled = 1;
+ param->idx = ies[index + 9];
+
+ if (ies[index + 10] & BIT(7)) {
+ param->opp_enabled = 1;
+ param->ct_window = ies[index + 10];
} else {
- pNewJoinBssParam->opp_enabled = 0;
+ param->opp_enabled = 0;
}

- pNewJoinBssParam->cnt = pu8IEs[index + 11];
- u16P2P_count = index + 12;
+ param->cnt = ies[index + 11];
+ p2p_cnt = index + 12;

- memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4);
- u16P2P_count += 4;
+ memcpy(param->duration, ies + p2p_cnt, 4);
+ p2p_cnt += 4;

- memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4);
- u16P2P_count += 4;
+ memcpy(param->interval, ies + p2p_cnt, 4);
+ p2p_cnt += 4;

- memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4);
+ memcpy(param->start_time, ies + p2p_cnt, 4);

- index += pu8IEs[index + 1] + 2;
- } else if ((pu8IEs[index] == RSN_IE) ||
- ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
- (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
- (pu8IEs[index + 5] == 0x01))) {
- u16 rsnIndex = index;
+ index += ies[index + 1] + 2;
+ } else if ((ies[index] == RSN_IE) ||
+ ((ies[index] == WPA_IE) && (ies[index + 2] == 0x00) &&
+ (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
+ (ies[index + 5] == 0x01))) {
+ u16 rsn_idx = index;

- if (pu8IEs[rsnIndex] == RSN_IE) {
- pNewJoinBssParam->mode_802_11i = 2;
+ if (ies[rsn_idx] == RSN_IE) {
+ param->mode_802_11i = 2;
} else {
- if (pNewJoinBssParam->mode_802_11i == 0)
- pNewJoinBssParam->mode_802_11i = 1;
- rsnIndex += 4;
+ if (param->mode_802_11i == 0)
+ param->mode_802_11i = 1;
+ rsn_idx += 4;
}

- rsnIndex += 7;
- pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex];
- rsnIndex++;
- jumpOffset = pu8IEs[rsnIndex] * 4;
- pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
- rsnIndex += 2;
+ rsn_idx += 7;
+ param->rsn_grp_policy = ies[rsn_idx];
+ rsn_idx++;
+ offset = ies[rsn_idx] * 4;
+ pcipher_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+ rsn_idx += 2;

- for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++)
- pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
+ for (i = pcipher_total_cnt, j = 0; i < pcipher_cnt + pcipher_total_cnt && i < 3; i++, j++)
+ param->rsn_pcip_policy[i] = ies[rsn_idx + ((j + 1) * 4) - 1];

- pcipherTotalCount += pcipherCount;
- rsnIndex += jumpOffset;
+ pcipher_total_cnt += pcipher_cnt;
+ rsn_idx += offset;

- jumpOffset = pu8IEs[rsnIndex] * 4;
+ offset = ies[rsn_idx] * 4;

- authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
- rsnIndex += 2;
+ auth_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+ rsn_idx += 2;

- for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++)
- pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
+ for (i = auth_total_cnt, j = 0; i < auth_total_cnt + auth_cnt; i++, j++)
+ param->rsn_auth_policy[i] = ies[rsn_idx + ((j + 1) * 4) - 1];

- authTotalCount += authCount;
- rsnIndex += jumpOffset;
+ auth_total_cnt += auth_cnt;
+ rsn_idx += offset;

- if (pu8IEs[index] == RSN_IE) {
- pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex];
- pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1];
- rsnIndex += 2;
+ if (ies[index] == RSN_IE) {
+ param->rsn_cap[0] = ies[rsn_idx];
+ param->rsn_cap[1] = ies[rsn_idx + 1];
+ rsn_idx += 2;
}
- pNewJoinBssParam->rsn_found = true;
- index += pu8IEs[index + 1] + 2;
+ param->rsn_found = true;
+ index += ies[index + 1] + 2;
} else {
- index += pu8IEs[index + 1] + 2;
+ index += ies[index + 1] + 2;
}
}
}

- return (void *)pNewJoinBssParam;
+ return (void *)param;
}

int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
--
2.7.4

2018-01-22 10:23:00

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef

Fix the "do not add new typedefs" issue found by checkpatch.pl
script

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/wilc_wlan_if.h | 72 ++++++++++++++++-----------------
1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 1641ddb..e186509 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -114,28 +114,28 @@ enum {
G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
};

-typedef enum {
+enum {
G_SHORT_PREAMBLE = 0, /* Short Preamble */
G_LONG_PREAMBLE = 1, /* Long Preamble */
G_AUTO_PREAMBLE = 2, /* Auto Preamble Selection */
-} G_PREAMBLE_T;
+};

#define MAC_CONNECTED 1
#define MAC_DISCONNECTED 0

#define SCAN_DONE TRUE
-typedef enum {
+enum {
PASSIVE_SCAN = 0,
ACTIVE_SCAN = 1,
-} SCANTYPE_T;
+};

-typedef enum {
+enum {
NO_POWERSAVE = 0,
MIN_FAST_PS = 1,
MAX_FAST_PS = 2,
MIN_PSPOLL_PS = 3,
MAX_PSPOLL_PS = 4
-} USER_PS_MODE_T;
+};

enum chip_ps_states {
CHIP_WAKEDUP = 0,
@@ -153,7 +153,7 @@ enum bus_release {
RELEASE_ALLOW_SLEEP = 1,
};

-typedef enum {
+enum {
NO_SECURITY = 0,
WEP_40 = 0x3,
WEP_104 = 0x7,
@@ -163,7 +163,7 @@ typedef enum {
WPA2_AES = 0x31,
WPA2_TKIP = 0x51,
WPA2_AES_TKIP = 0x71, /* Aes or Tkip */
-} SECURITY_T;
+};

enum AUTHTYPE {
OPEN_SYSTEM = 1,
@@ -178,88 +178,88 @@ enum SITESURVEY {
SITE_SURVEY_OFF = 2
};

-typedef enum {
+enum {
NORMAL_ACK = 0,
NO_ACK,
-} ACK_POLICY_T;
+};

-typedef enum {
+enum {
DONT_RESET = 0,
DO_RESET = 1,
NO_REQUEST = 2,
-} RESET_REQ_T;
+};

-typedef enum {
+enum {
REKEY_DISABLE = 1,
REKEY_TIME_BASE,
REKEY_PKT_BASE,
REKEY_TIME_PKT_BASE
-} RSNA_REKEY_POLICY_T;
+};

-typedef enum {
+enum {
FILTER_NO = 0x00,
FILTER_AP_ONLY = 0x01,
FILTER_STA_ONLY = 0x02
-} SCAN_CLASS_FITLER_T;
+};

-typedef enum {
+enum {
PRI_HIGH_RSSI = 0x00,
PRI_LOW_RSSI = 0x04,
PRI_DETECT = 0x08
-} SCAN_PRI_T;
+};

-typedef enum {
+enum {
CH_FILTER_OFF = 0x00,
CH_FILTER_ON = 0x10
-} CH_FILTER_T;
+};

-typedef enum {
+enum {
AUTO_PROT = 0, /* Auto */
NO_PROT, /* Do not use any protection */
ERP_PROT, /* Protect all ERP frame exchanges */
HT_PROT, /* Protect all HT frame exchanges */
GF_PROT, /* Protect all GF frame exchanges */
-} N_PROTECTION_MODE_T;
+};

-typedef enum {
+enum {
G_SELF_CTS_PROT,
G_RTS_CTS_PROT,
-} G_PROTECTION_MODE_T;
+};

-typedef enum {
+enum {
HT_MIXED_MODE = 1,
HT_ONLY_20MHZ_MODE,
HT_ONLY_20_40MHZ_MODE,
-} N_OPERATING_MODE_T;
+};

-typedef enum {
+enum {
NO_DETECT = 0,
DETECT_ONLY = 1,
DETECT_PROTECT = 2,
DETECT_PROTECT_REPORT = 3,
-} N_OBSS_DETECTION_T;
+};

-typedef enum {
+enum {
RTS_CTS_NONHT_PROT = 0, /* RTS-CTS at non-HT rate */
FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
LSIG_TXOP_PROT, /* LSIG TXOP Protection */
FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
-} N_PROTECTION_TYPE_T;
+};

-typedef enum {
+enum {
STATIC_MODE = 1,
DYNAMIC_MODE = 2,
MIMO_MODE = 3, /* power save disable */
-} N_SMPS_MODE_T;
+};

-typedef enum {
+enum {
DISABLE_SELF_CTS,
ENABLE_SELF_CTS,
DISABLE_TX_ABORT,
ENABLE_TX_ABORT,
HW_TRIGGER_ABORT,
SW_TRIGGER_ABORT,
-} TX_ABORT_OPTION_T;
+};

enum wid_type {
WID_CHAR = 0,
@@ -281,7 +281,7 @@ struct wid {
s8 *val;
};

-typedef enum {
+enum {
WID_NIL = 0xffff,

/*
@@ -889,7 +889,7 @@ typedef enum {
/* Miscellaneous WIDs */
WID_ALL = 0x7FFE,
WID_MAX = 0xFFFF
-} WID_T;
+};

struct wilc;
int wilc_wlan_init(struct net_device *dev);
--
2.7.4

2018-01-22 10:23:13

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 06/14] staging: wilc1000: rename strWIDList variable to wid_list to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.
Rename variable name from strWIDList to wid_list.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 176 +++++++++++++++---------------
1 file changed, 88 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index f0168e3..13ac482 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -906,7 +906,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
struct connect_attr *pstrHostIFconnectAttr)
{
s32 result = 0;
- struct wid strWIDList[8];
+ struct wid wid_list[8];
u32 u32WidsCount = 0, dummyval = 0;
u8 *pu8CurrByte = NULL;
struct join_bss_param *ptstrJoinBssParam;
@@ -952,29 +952,29 @@ static s32 Handle_Connect(struct wilc_vif *vif,
hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;

- strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
- strWIDList[u32WidsCount].type = WID_INT;
- strWIDList[u32WidsCount].size = sizeof(u32);
- strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
+ wid_list[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
+ wid_list[u32WidsCount].type = WID_INT;
+ wid_list[u32WidsCount].size = sizeof(u32);
+ wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;

- strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
- strWIDList[u32WidsCount].type = WID_INT;
- strWIDList[u32WidsCount].size = sizeof(u32);
- strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
+ wid_list[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
+ wid_list[u32WidsCount].type = WID_INT;
+ wid_list[u32WidsCount].size = sizeof(u32);
+ wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;

- strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
- strWIDList[u32WidsCount].type = WID_INT;
- strWIDList[u32WidsCount].size = sizeof(u32);
- strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
+ wid_list[u32WidsCount].id = WID_FAILED_COUNT;
+ wid_list[u32WidsCount].type = WID_INT;
+ wid_list[u32WidsCount].size = sizeof(u32);
+ wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;

{
- strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
- strWIDList[u32WidsCount].type = WID_BIN_DATA;
- strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.ies;
- strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ies_len;
+ wid_list[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
+ wid_list[u32WidsCount].type = WID_BIN_DATA;
+ wid_list[u32WidsCount].val = hif_drv->usr_conn_req.ies;
+ wid_list[u32WidsCount].size = hif_drv->usr_conn_req.ies_len;
u32WidsCount++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
@@ -984,39 +984,39 @@ static s32 Handle_Connect(struct wilc_vif *vif,
info_element_size);
}
}
- strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
- strWIDList[u32WidsCount].type = WID_CHAR;
- strWIDList[u32WidsCount].size = sizeof(char);
- strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.security;
+ wid_list[u32WidsCount].id = (u16)WID_11I_MODE;
+ wid_list[u32WidsCount].type = WID_CHAR;
+ wid_list[u32WidsCount].size = sizeof(char);
+ wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.security;
u32WidsCount++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;

- strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
- strWIDList[u32WidsCount].type = WID_CHAR;
- strWIDList[u32WidsCount].size = sizeof(char);
- strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
+ wid_list[u32WidsCount].id = (u16)WID_AUTH_TYPE;
+ wid_list[u32WidsCount].type = WID_CHAR;
+ wid_list[u32WidsCount].size = sizeof(char);
+ wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
u32WidsCount++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
auth_type = (u8)hif_drv->usr_conn_req.auth_type;

- strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
- strWIDList[u32WidsCount].type = WID_STR;
- strWIDList[u32WidsCount].size = 112;
- strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL);
+ wid_list[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
+ wid_list[u32WidsCount].type = WID_STR;
+ wid_list[u32WidsCount].size = 112;
+ wid_list[u32WidsCount].val = kmalloc(wid_list[u32WidsCount].size, GFP_KERNEL);

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
- join_req_size = strWIDList[u32WidsCount].size;
+ join_req_size = wid_list[u32WidsCount].size;
join_req = kmalloc(join_req_size, GFP_KERNEL);
}
- if (!strWIDList[u32WidsCount].val) {
+ if (!wid_list[u32WidsCount].val) {
result = -EFAULT;
goto ERRORHANDLER;
}

- pu8CurrByte = strWIDList[u32WidsCount].val;
+ pu8CurrByte = wid_list[u32WidsCount].val;

if (pstrHostIFconnectAttr->ssid) {
memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
@@ -1095,7 +1095,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
pu8CurrByte += sizeof(ptstrJoinBssParam->start_time);
}

- pu8CurrByte = strWIDList[u32WidsCount].val;
+ pu8CurrByte = wid_list[u32WidsCount].val;
u32WidsCount++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
@@ -1107,7 +1107,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
memcpy(wilc_connected_ssid,
pstrHostIFconnectAttr->bssid, ETH_ALEN);

- result = wilc_send_config_pkt(vif, SET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
u32WidsCount,
wilc_get_vif_idx(vif));
if (result) {
@@ -1530,7 +1530,7 @@ static int Handle_Key(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- struct wid strWIDList[5];
+ struct wid wid_list[5];
u8 i;
u8 *pu8keybuf;
s8 s8idxarray[1];
@@ -1541,15 +1541,15 @@ static int Handle_Key(struct wilc_vif *vif,
case WEP:

if (pstrHostIFkeyAttr->action & ADDKEY_AP) {
- strWIDList[0].id = (u16)WID_11I_MODE;
- strWIDList[0].type = WID_CHAR;
- strWIDList[0].size = sizeof(char);
- strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode;
+ wid_list[0].id = (u16)WID_11I_MODE;
+ wid_list[0].type = WID_CHAR;
+ wid_list[0].size = sizeof(char);
+ wid_list[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode;

- strWIDList[1].id = WID_AUTH_TYPE;
- strWIDList[1].type = WID_CHAR;
- strWIDList[1].size = sizeof(char);
- strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type;
+ wid_list[1].id = WID_AUTH_TYPE;
+ wid_list[1].type = WID_CHAR;
+ wid_list[1].size = sizeof(char);
+ wid_list[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type;

pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2,
GFP_KERNEL);
@@ -1564,13 +1564,13 @@ static int Handle_Key(struct wilc_vif *vif,

kfree(pstrHostIFkeyAttr->attr.wep.key);

- strWIDList[2].id = (u16)WID_WEP_KEY_VALUE;
- strWIDList[2].type = WID_STR;
- strWIDList[2].size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
- strWIDList[2].val = (s8 *)pu8keybuf;
+ wid_list[2].id = (u16)WID_WEP_KEY_VALUE;
+ wid_list[2].type = WID_STR;
+ wid_list[2].size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
+ wid_list[2].val = (s8 *)pu8keybuf;

result = wilc_send_config_pkt(vif, SET_CFG,
- strWIDList, 3,
+ wid_list, 3,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & ADDKEY) {
@@ -1632,18 +1632,18 @@ static int Handle_Key(struct wilc_vif *vif,
memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key,
pstrHostIFkeyAttr->attr.wpa.key_len);

- strWIDList[0].id = (u16)WID_11I_MODE;
- strWIDList[0].type = WID_CHAR;
- strWIDList[0].size = sizeof(char);
- strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode;
+ wid_list[0].id = (u16)WID_11I_MODE;
+ wid_list[0].type = WID_CHAR;
+ wid_list[0].size = sizeof(char);
+ wid_list[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode;

- strWIDList[1].id = (u16)WID_ADD_RX_GTK;
- strWIDList[1].type = WID_STR;
- strWIDList[1].val = (s8 *)pu8keybuf;
- strWIDList[1].size = RX_MIC_KEY_MSG_LEN;
+ wid_list[1].id = (u16)WID_ADD_RX_GTK;
+ wid_list[1].type = WID_STR;
+ wid_list[1].val = (s8 *)pu8keybuf;
+ wid_list[1].size = RX_MIC_KEY_MSG_LEN;

result = wilc_send_config_pkt(vif, SET_CFG,
- strWIDList, 2,
+ wid_list, 2,
wilc_get_vif_idx(vif));

kfree(pu8keybuf);
@@ -1700,18 +1700,18 @@ static int Handle_Key(struct wilc_vif *vif,
memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->attr.wpa.key,
pstrHostIFkeyAttr->attr.wpa.key_len);

- strWIDList[0].id = (u16)WID_11I_MODE;
- strWIDList[0].type = WID_CHAR;
- strWIDList[0].size = sizeof(char);
- strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode;
+ wid_list[0].id = (u16)WID_11I_MODE;
+ wid_list[0].type = WID_CHAR;
+ wid_list[0].size = sizeof(char);
+ wid_list[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode;

- strWIDList[1].id = (u16)WID_ADD_PTK;
- strWIDList[1].type = WID_STR;
- strWIDList[1].val = (s8 *)pu8keybuf;
- strWIDList[1].size = PTK_KEY_MSG_LEN + 1;
+ wid_list[1].id = (u16)WID_ADD_PTK;
+ wid_list[1].type = WID_STR;
+ wid_list[1].val = (s8 *)pu8keybuf;
+ wid_list[1].size = PTK_KEY_MSG_LEN + 1;

result = wilc_send_config_pkt(vif, SET_CFG,
- strWIDList, 2,
+ wid_list, 2,
wilc_get_vif_idx(vif));
kfree(pu8keybuf);
complete(&hif_drv->comp_test_key_block);
@@ -1892,40 +1892,40 @@ static void Handle_GetRssi(struct wilc_vif *vif)
static s32 Handle_GetStatistics(struct wilc_vif *vif,
struct rf_info *pstrStatistics)
{
- struct wid strWIDList[5];
+ struct wid wid_list[5];
u32 u32WidsCount = 0, result = 0;

- strWIDList[u32WidsCount].id = WID_LINKSPEED;
- strWIDList[u32WidsCount].type = WID_CHAR;
- strWIDList[u32WidsCount].size = sizeof(char);
- strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->link_speed;
+ wid_list[u32WidsCount].id = WID_LINKSPEED;
+ wid_list[u32WidsCount].type = WID_CHAR;
+ wid_list[u32WidsCount].size = sizeof(char);
+ wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->link_speed;
u32WidsCount++;

- strWIDList[u32WidsCount].id = WID_RSSI;
- strWIDList[u32WidsCount].type = WID_CHAR;
- strWIDList[u32WidsCount].size = sizeof(char);
- strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rssi;
+ wid_list[u32WidsCount].id = WID_RSSI;
+ wid_list[u32WidsCount].type = WID_CHAR;
+ wid_list[u32WidsCount].size = sizeof(char);
+ wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->rssi;
u32WidsCount++;

- strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
- strWIDList[u32WidsCount].type = WID_INT;
- strWIDList[u32WidsCount].size = sizeof(u32);
- strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_cnt;
+ wid_list[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
+ wid_list[u32WidsCount].type = WID_INT;
+ wid_list[u32WidsCount].size = sizeof(u32);
+ wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->tx_cnt;
u32WidsCount++;

- strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
- strWIDList[u32WidsCount].type = WID_INT;
- strWIDList[u32WidsCount].size = sizeof(u32);
- strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rx_cnt;
+ wid_list[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
+ wid_list[u32WidsCount].type = WID_INT;
+ wid_list[u32WidsCount].size = sizeof(u32);
+ wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->rx_cnt;
u32WidsCount++;

- strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
- strWIDList[u32WidsCount].type = WID_INT;
- strWIDList[u32WidsCount].size = sizeof(u32);
- strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
+ wid_list[u32WidsCount].id = WID_FAILED_COUNT;
+ wid_list[u32WidsCount].type = WID_INT;
+ wid_list[u32WidsCount].size = sizeof(u32);
+ wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
u32WidsCount++;

- result = wilc_send_config_pkt(vif, GET_CFG, strWIDList,
+ result = wilc_send_config_pkt(vif, GET_CFG, wid_list,
u32WidsCount,
wilc_get_vif_idx(vif));

--
2.7.4

2018-01-30 16:10:12

by Ajay Singh

[permalink] [raw]
Subject: Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

On Tue, 30 Jan 2018 17:40:31 +0300
Dan Carpenter <[email protected]> wrote:

> On Tue, Jan 30, 2018 at 07:29:49PM +0530, Ajay Singh wrote:
> > On Tue, 30 Jan 2018 02:13:53 +0800
> > kbuild test robot <[email protected]> wrote:
> >
>
> >
> >
> > The patch only change variable names to avoid the camelCase, didn't modify any extra code to dereference memory.
>
> You are responding to a robot and I think we all understood that this
> warning was there before you renamed the variables.
>
Thanks, got it.

> > I think, with the use of shorter variable name now memcpy() is taking 1 line instead of 3 lines. So, now line 937 has different code line(as code is swifted up by few lines).So because of that new potential NULL dereference error is popped up for same existing code.
> > The code to validate dynamically allocated memory before access, will be include in separate patch to keep it segregated from variable names changes.
> > I will rework on this patch and resend again.
>
> There is no need to re-work the patch.
>

Few of the patches for patch series are accepted and submitted to "linux-next". For now, will submit the a new patch series by including the remaining patches (changing commit subject line to avoid confusion from previous patches).

> You are right that the NULL check should be added as a separate check.
>
> regards,
> dan carpenter
>


Regards,
Ajay

2018-01-22 11:07:53

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 12/14] staging: wilc1000: rename Handle_ScanDone() to avoid camelCase



On 22.01.2018 12:22, Ajay Singh wrote:
> Fix "Avoid camelCase" issue reported by checkpatch.pl
> script.
Same here as in patch 02 of this series.

>
> Signed-off-by: Ajay Singh <[email protected]>
> Reviewed-by: Claudiu Beznea <[email protected]>
> ---
> drivers/staging/wilc1000/host_interface.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 0eaf6c6..b34243c 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -267,7 +267,7 @@ static struct wilc_vif *join_req_vif;
>
> static void *host_int_parse_join_bss_param(struct network_info *info);
> static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
> -static s32 Handle_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
> +static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event enuEvent);
> static void host_if_work(struct work_struct *work);
>
> /*!
> @@ -847,7 +847,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
> ERRORHANDLER:
> if (result) {
> del_timer(&hif_drv->scan_timer);
> - Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(vif, SCAN_EVENT_ABORTED);
> }
>
> kfree(scan_info->ch_freq_list);
> @@ -863,8 +863,8 @@ static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
> return result;
> }
>
> -static s32 Handle_ScanDone(struct wilc_vif *vif,
> - enum scan_event enuEvent)
> +static s32 handle_scan_done(struct wilc_vif *vif,
> + enum scan_event enuEvent)
> {
> s32 result = 0;
> u8 u8abort_running_scan;
> @@ -1460,7 +1460,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
>
> if (hif_drv->usr_scan_req.scan_result) {
> del_timer(&hif_drv->scan_timer);
> - Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(vif, SCAN_EVENT_ABORTED);
> }
>
> strDisconnectNotifInfo.reason = 0;
> @@ -1508,7 +1508,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
> (hif_drv->usr_scan_req.scan_result)) {
> del_timer(&hif_drv->scan_timer);
> if (hif_drv->usr_scan_req.scan_result)
> - Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(vif, SCAN_EVENT_ABORTED);
> }
> }
>
> @@ -2525,7 +2525,7 @@ static void host_if_work(struct work_struct *work)
> if (!wilc_wlan_get_num_conn_ifcs(wilc))
> wilc_chip_sleep_manually(wilc);
>
> - Handle_ScanDone(msg->vif, SCAN_EVENT_DONE);
> + handle_scan_done(msg->vif, SCAN_EVENT_DONE);
>
> if (msg->vif->hif_drv->remain_on_ch_pending)
> Handle_RemainOnChan(msg->vif,
> @@ -2567,7 +2567,7 @@ static void host_if_work(struct work_struct *work)
> break;
>
> case HOST_IF_MSG_SCAN_TIMER_FIRED:
> - Handle_ScanDone(msg->vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(msg->vif, SCAN_EVENT_ABORTED);
> break;
>
> case HOST_IF_MSG_CONNECT_TIMER_FIRED:
>

2018-01-22 10:23:16

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 07/14] staging: wilc1000: rename u32WidsCount variable to avoid camelCase

Fix "Avoid camleCase" issue reported by checkpatch.pl script.
rename variable name from u32WidsCount to wid_cnt to fix
checkpatch.pl report issue.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 146 +++++++++++++++---------------
1 file changed, 73 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 13ac482..496c72f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -907,7 +907,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid_list[8];
- u32 u32WidsCount = 0, dummyval = 0;
+ u32 wid_cnt = 0, dummyval = 0;
u8 *pu8CurrByte = NULL;
struct join_bss_param *ptstrJoinBssParam;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -952,30 +952,30 @@ static s32 Handle_Connect(struct wilc_vif *vif,
hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;

- wid_list[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
- wid_list[u32WidsCount].type = WID_INT;
- wid_list[u32WidsCount].size = sizeof(u32);
- wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
- u32WidsCount++;
+ wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
+ wid_list[wid_cnt].type = WID_INT;
+ wid_list[wid_cnt].size = sizeof(u32);
+ wid_list[wid_cnt].val = (s8 *)(&(dummyval));
+ wid_cnt++;

- wid_list[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
- wid_list[u32WidsCount].type = WID_INT;
- wid_list[u32WidsCount].size = sizeof(u32);
- wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
- u32WidsCount++;
+ wid_list[wid_cnt].id = WID_RECEIVED_FRAGMENT_COUNT;
+ wid_list[wid_cnt].type = WID_INT;
+ wid_list[wid_cnt].size = sizeof(u32);
+ wid_list[wid_cnt].val = (s8 *)(&(dummyval));
+ wid_cnt++;

- wid_list[u32WidsCount].id = WID_FAILED_COUNT;
- wid_list[u32WidsCount].type = WID_INT;
- wid_list[u32WidsCount].size = sizeof(u32);
- wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
- u32WidsCount++;
+ wid_list[wid_cnt].id = WID_FAILED_COUNT;
+ wid_list[wid_cnt].type = WID_INT;
+ wid_list[wid_cnt].size = sizeof(u32);
+ wid_list[wid_cnt].val = (s8 *)(&(dummyval));
+ wid_cnt++;

{
- wid_list[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
- wid_list[u32WidsCount].type = WID_BIN_DATA;
- wid_list[u32WidsCount].val = hif_drv->usr_conn_req.ies;
- wid_list[u32WidsCount].size = hif_drv->usr_conn_req.ies_len;
- u32WidsCount++;
+ 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;
@@ -984,39 +984,39 @@ static s32 Handle_Connect(struct wilc_vif *vif,
info_element_size);
}
}
- wid_list[u32WidsCount].id = (u16)WID_11I_MODE;
- wid_list[u32WidsCount].type = WID_CHAR;
- wid_list[u32WidsCount].size = sizeof(char);
- wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.security;
- u32WidsCount++;
+ wid_list[wid_cnt].id = (u16)WID_11I_MODE;
+ wid_list[wid_cnt].type = WID_CHAR;
+ wid_list[wid_cnt].size = sizeof(char);
+ wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
+ wid_cnt++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;

- wid_list[u32WidsCount].id = (u16)WID_AUTH_TYPE;
- wid_list[u32WidsCount].type = WID_CHAR;
- wid_list[u32WidsCount].size = sizeof(char);
- wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
- u32WidsCount++;
+ wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
+ wid_list[wid_cnt].type = WID_CHAR;
+ wid_list[wid_cnt].size = sizeof(char);
+ wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
+ wid_cnt++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
auth_type = (u8)hif_drv->usr_conn_req.auth_type;

- wid_list[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
- wid_list[u32WidsCount].type = WID_STR;
- wid_list[u32WidsCount].size = 112;
- wid_list[u32WidsCount].val = kmalloc(wid_list[u32WidsCount].size, GFP_KERNEL);
+ wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
+ wid_list[wid_cnt].type = WID_STR;
+ wid_list[wid_cnt].size = 112;
+ wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
- join_req_size = wid_list[u32WidsCount].size;
+ join_req_size = wid_list[wid_cnt].size;
join_req = kmalloc(join_req_size, GFP_KERNEL);
}
- if (!wid_list[u32WidsCount].val) {
+ if (!wid_list[wid_cnt].val) {
result = -EFAULT;
goto ERRORHANDLER;
}

- pu8CurrByte = wid_list[u32WidsCount].val;
+ pu8CurrByte = wid_list[wid_cnt].val;

if (pstrHostIFconnectAttr->ssid) {
memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
@@ -1095,8 +1095,8 @@ static s32 Handle_Connect(struct wilc_vif *vif,
pu8CurrByte += sizeof(ptstrJoinBssParam->start_time);
}

- pu8CurrByte = wid_list[u32WidsCount].val;
- u32WidsCount++;
+ pu8CurrByte = wid_list[wid_cnt].val;
+ wid_cnt++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
memcpy(join_req, pu8CurrByte, join_req_size);
@@ -1108,7 +1108,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
pstrHostIFconnectAttr->bssid, ETH_ALEN);

result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
- u32WidsCount,
+ wid_cnt,
wilc_get_vif_idx(vif));
if (result) {
netdev_err(vif->ndev, "failed to send config packet\n");
@@ -1893,40 +1893,40 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
struct rf_info *pstrStatistics)
{
struct wid wid_list[5];
- u32 u32WidsCount = 0, result = 0;
-
- wid_list[u32WidsCount].id = WID_LINKSPEED;
- wid_list[u32WidsCount].type = WID_CHAR;
- wid_list[u32WidsCount].size = sizeof(char);
- wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->link_speed;
- u32WidsCount++;
-
- wid_list[u32WidsCount].id = WID_RSSI;
- wid_list[u32WidsCount].type = WID_CHAR;
- wid_list[u32WidsCount].size = sizeof(char);
- wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->rssi;
- u32WidsCount++;
-
- wid_list[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
- wid_list[u32WidsCount].type = WID_INT;
- wid_list[u32WidsCount].size = sizeof(u32);
- wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->tx_cnt;
- u32WidsCount++;
-
- wid_list[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
- wid_list[u32WidsCount].type = WID_INT;
- wid_list[u32WidsCount].size = sizeof(u32);
- wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->rx_cnt;
- u32WidsCount++;
-
- wid_list[u32WidsCount].id = WID_FAILED_COUNT;
- wid_list[u32WidsCount].type = WID_INT;
- wid_list[u32WidsCount].size = sizeof(u32);
- wid_list[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
- u32WidsCount++;
+ u32 wid_cnt = 0, result = 0;
+
+ wid_list[wid_cnt].id = WID_LINKSPEED;
+ wid_list[wid_cnt].type = WID_CHAR;
+ wid_list[wid_cnt].size = sizeof(char);
+ wid_list[wid_cnt].val = (s8 *)&pstrStatistics->link_speed;
+ wid_cnt++;
+
+ wid_list[wid_cnt].id = WID_RSSI;
+ wid_list[wid_cnt].type = WID_CHAR;
+ wid_list[wid_cnt].size = sizeof(char);
+ wid_list[wid_cnt].val = (s8 *)&pstrStatistics->rssi;
+ wid_cnt++;
+
+ wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
+ wid_list[wid_cnt].type = WID_INT;
+ wid_list[wid_cnt].size = sizeof(u32);
+ wid_list[wid_cnt].val = (s8 *)&pstrStatistics->tx_cnt;
+ wid_cnt++;
+
+ wid_list[wid_cnt].id = WID_RECEIVED_FRAGMENT_COUNT;
+ wid_list[wid_cnt].type = WID_INT;
+ wid_list[wid_cnt].size = sizeof(u32);
+ wid_list[wid_cnt].val = (s8 *)&pstrStatistics->rx_cnt;
+ wid_cnt++;
+
+ wid_list[wid_cnt].id = WID_FAILED_COUNT;
+ wid_list[wid_cnt].type = WID_INT;
+ wid_list[wid_cnt].size = sizeof(u32);
+ wid_list[wid_cnt].val = (s8 *)&pstrStatistics->tx_fail_cnt;
+ wid_cnt++;

result = wilc_send_config_pkt(vif, GET_CFG, wid_list,
- u32WidsCount,
+ wid_cnt,
wilc_get_vif_idx(vif));

if (result)
--
2.7.4

2018-01-22 10:22:57

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 01/14] staging: wilc1000: remove unnecessary use of parentheses

Fix "Unnecessary parentheses around" issue found by checkpatch.pl
script.Remove the unnecessary parentheses to follow linux coding style.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/coreconfigurator.c | 2 +-
drivers/staging/wilc1000/host_interface.c | 34 +++++++++++------------
drivers/staging/wilc1000/linux_wlan.c | 8 +++---
drivers/staging/wilc1000/wilc_sdio.c | 4 +--
drivers/staging/wilc1000/wilc_spi.c | 20 ++++++-------
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 26 ++++++++---------
drivers/staging/wilc1000/wilc_wlan.c | 2 +-
drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 ++--
8 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 8cf886d..e98fc8e 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -201,7 +201,7 @@ static inline u16 get_cap_info(u8 *data)

st = get_sub_type(data);

- if ((st == BEACON) || (st == PROBE_RSP))
+ if (st == BEACON || st == PROBE_RSP)
index += TIME_STAMP_LEN + BEACON_INTERVAL_LEN;

cap_info = data[index];
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4ff1a59..46e2d55 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -394,7 +394,7 @@ static void handle_set_operation_mode(struct wilc_vif *vif,
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));

- if ((hif_op_mode->mode) == IDLE_MODE)
+ if (hif_op_mode->mode == IDLE_MODE)
complete(&hif_driver_comp);

if (ret)
@@ -760,8 +760,8 @@ static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
hif_drv->usr_scan_req.scan_result = scan_info->result;
hif_drv->usr_scan_req.arg = scan_info->arg;

- if ((hif_drv->hif_state >= HOST_IF_SCANNING) &&
- (hif_drv->hif_state < HOST_IF_CONNECTED)) {
+ if (hif_drv->hif_state >= HOST_IF_SCANNING &&
+ hif_drv->hif_state < HOST_IF_CONNECTED) {
netdev_err(vif->ndev, "Already scan\n");
result = -EBUSY;
goto ERRORHANDLER;
@@ -1025,7 +1025,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
pu8CurrByte += MAX_SSID_LEN;
*(pu8CurrByte++) = INFRASTRUCTURE;

- if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 14)) {
+ if (pstrHostIFconnectAttr->ch >= 1 && pstrHostIFconnectAttr->ch <= 14) {
*(pu8CurrByte++) = pstrHostIFconnectAttr->ch;
} else {
netdev_err(vif->ndev, "Channel out of range\n");
@@ -1258,8 +1258,8 @@ static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,

if (hif_drv->usr_scan_req.scan_result) {
wilc_parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo);
- if ((!pstrNetworkInfo) ||
- (!hif_drv->usr_scan_req.scan_result)) {
+ if (!pstrNetworkInfo ||
+ !hif_drv->usr_scan_req.scan_result) {
netdev_err(vif->ndev, "driver is null\n");
result = -EINVAL;
goto done;
@@ -1340,8 +1340,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
return -ENODEV;
}

- if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
- (hif_drv->hif_state == HOST_IF_CONNECTED) ||
+ if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
+ hif_drv->hif_state == HOST_IF_CONNECTED ||
hif_drv->usr_scan_req.scan_result) {
if (!pstrRcvdGnrlAsyncInfo->buffer ||
!hif_drv->usr_conn_req.conn_result) {
@@ -1400,8 +1400,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
}
}

- if ((u8MacStatus == MAC_CONNECTED) &&
- (strConnectInfo.status != SUCCESSFUL_STATUSCODE)) {
+ if (u8MacStatus == MAC_CONNECTED &&
+ strConnectInfo.status != SUCCESSFUL_STATUSCODE) {
netdev_err(vif->ndev, "Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
eth_zero_addr(wilc_connected_ssid);
} else if (u8MacStatus == MAC_DISCONNECTED) {
@@ -1412,8 +1412,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
if (hif_drv->usr_conn_req.bssid) {
memcpy(strConnectInfo.bssid, hif_drv->usr_conn_req.bssid, 6);

- if ((u8MacStatus == MAC_CONNECTED) &&
- (strConnectInfo.status == SUCCESSFUL_STATUSCODE)) {
+ if (u8MacStatus == MAC_CONNECTED &&
+ strConnectInfo.status == SUCCESSFUL_STATUSCODE) {
memcpy(hif_drv->assoc_bssid,
hif_drv->usr_conn_req.bssid, ETH_ALEN);
}
@@ -1434,8 +1434,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
NULL,
hif_drv->usr_conn_req.arg);

- if ((u8MacStatus == MAC_CONNECTED) &&
- (strConnectInfo.status == SUCCESSFUL_STATUSCODE)) {
+ if (u8MacStatus == MAC_CONNECTED &&
+ strConnectInfo.status == SUCCESSFUL_STATUSCODE) {
wilc_set_power_mgmt(vif, 0, 0);

hif_drv->hif_state = HOST_IF_CONNECTED;
@@ -1864,8 +1864,8 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
{
if (!vif->hif_drv)
return;
- if ((vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
- (vif->hif_drv->hif_state == HOST_IF_CONNECTING))
+ if (vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
+ vif->hif_drv->hif_state == HOST_IF_CONNECTING)
wilc_disconnect(vif, 1);
}

@@ -2414,7 +2414,7 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif,

wid.id = (u16)WID_SETUP_MULTICAST_FILTER;
wid.type = WID_BIN;
- wid.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->cnt) * ETH_ALEN);
+ wid.size = sizeof(struct set_multicast) + (strHostIfSetMulti->cnt * ETH_ALEN);
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
goto ERRORHANDLER;
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index da1fe43..3c3f1863 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -911,13 +911,13 @@ static void wilc_set_multicast_list(struct net_device *dev)
if (dev->flags & IFF_PROMISC)
return;

- if ((dev->flags & IFF_ALLMULTI) ||
- (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
+ if (dev->flags & IFF_ALLMULTI ||
+ dev->mc.count > WILC_MULTICAST_TABLE_SIZE) {
wilc_setup_multicast_filter(vif, false, 0);
return;
}

- if ((dev->mc.count) == 0) {
+ if (dev->mc.count == 0) {
wilc_setup_multicast_filter(vif, true, 0);
return;
}
@@ -1030,7 +1030,7 @@ static int wilc_mac_close(struct net_device *ndev)
if (!hif_drv)
return 0;

- if ((wl->open_ifcs) > 0)
+ if (wl->open_ifcs > 0)
wl->open_ifcs--;
else
return 0;
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index bd2b29b..bb65b37 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -375,7 +375,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)

data = cpu_to_le32(data);

- if ((addr >= 0xf0) && (addr <= 0xff)) {
+ if (addr >= 0xf0 && addr <= 0xff) {
struct sdio_cmd52 cmd;

cmd.read_write = 1;
@@ -515,7 +515,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
struct sdio_func *func = dev_to_sdio_func(wilc->dev);
int ret;

- if ((addr >= 0xf0) && (addr <= 0xff)) {
+ if (addr >= 0xf0 && addr <= 0xff) {
struct sdio_cmd52 cmd;

cmd.read_write = 0;
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index ff2ba10..8f71a60 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -390,11 +390,11 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
#define NUM_DATA_BYTES (4)
#define NUM_CRC_BYTES (2)
#define NUM_DUMMY_BYTES (3)
- if ((cmd == CMD_RESET) ||
- (cmd == CMD_TERMINATE) ||
- (cmd == CMD_REPEAT)) {
+ if (cmd == CMD_RESET ||
+ cmd == CMD_TERMINATE ||
+ cmd == CMD_REPEAT) {
len2 = len + (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES);
- } else if ((cmd == CMD_INTERNAL_READ) || (cmd == CMD_SINGLE_READ)) {
+ } else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
if (!g_spi.crc_off) {
len2 = len + (NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
+ NUM_CRC_BYTES + NUM_DUMMY_BYTES);
@@ -425,9 +425,9 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
/**
* Command/Control response
**/
- if ((cmd == CMD_RESET) ||
- (cmd == CMD_TERMINATE) ||
- (cmd == CMD_REPEAT)) {
+ if (cmd == CMD_RESET ||
+ cmd == CMD_TERMINATE ||
+ cmd == CMD_REPEAT) {
rix++; /* skip 1 byte */
}

@@ -453,8 +453,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
return N_FAIL;
}

- if ((cmd == CMD_INTERNAL_READ) || (cmd == CMD_SINGLE_READ) ||
- (cmd == CMD_DMA_READ) || (cmd == CMD_DMA_EXT_READ)) {
+ if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ ||
+ cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) {
int retry;
/* u16 crc1, crc2; */
u8 crc[2];
@@ -480,7 +480,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
return N_RESET;
}

- if ((cmd == CMD_INTERNAL_READ) || (cmd == CMD_SINGLE_READ)) {
+ if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
/**
* Read bytes
**/
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 47c7e2e..fb4a142 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -495,8 +495,8 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,

connect_status = conn_info->status;

- if ((mac_status == MAC_DISCONNECTED) &&
- (conn_info->status == SUCCESSFUL_STATUSCODE)) {
+ if (mac_status == MAC_DISCONNECTED &&
+ conn_info->status == SUCCESSFUL_STATUSCODE) {
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
@@ -548,9 +548,9 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt,

if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
- if ((wfi_drv->IFC_UP) && (dev == wl->vif[1]->ndev))
+ if (wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
disconn_info->reason = 3;
- else if ((!wfi_drv->IFC_UP) && (dev == wl->vif[1]->ndev))
+ else if (!wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
disconn_info->reason = 1;

cfg80211_disconnected(dev, disconn_info->reason, disconn_info->ie,
@@ -671,7 +671,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
wfi_drv->p2p_connect = 0;

for (i = 0; i < last_scanned_cnt; i++) {
- if ((sme->ssid_len == last_scanned_shadow[i].ssid_len) &&
+ if (sme->ssid_len == last_scanned_shadow[i].ssid_len &&
memcmp(last_scanned_shadow[i].ssid,
sme->ssid,
sme->ssid_len) == 0) {
@@ -932,7 +932,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len);
kfree(priv->wilc_gtk[key_index]->seq);

- if ((params->seq_len) > 0) {
+ if (params->seq_len > 0) {
priv->wilc_gtk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len);
}
@@ -964,12 +964,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,

kfree(priv->wilc_ptk[key_index]->seq);

- if ((params->seq_len) > 0)
+ if (params->seq_len > 0)
priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);

memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len);

- if ((params->seq_len) > 0)
+ if (params->seq_len > 0)
memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len);

priv->wilc_ptk[key_index]->cipher = params->cipher;
@@ -1082,7 +1082,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
kfree(g_key_wep_params.key);
g_key_wep_params.key = NULL;

- if ((priv->wilc_gtk[key_index]) != NULL) {
+ if (priv->wilc_gtk[key_index] != NULL) {
kfree(priv->wilc_gtk[key_index]->key);
priv->wilc_gtk[key_index]->key = NULL;
kfree(priv->wilc_gtk[key_index]->seq);
@@ -1092,7 +1092,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
priv->wilc_gtk[key_index] = NULL;
}

- if ((priv->wilc_ptk[key_index]) != NULL) {
+ if (priv->wilc_ptk[key_index] != NULL) {
kfree(priv->wilc_ptk[key_index]->key);
priv->wilc_ptk[key_index]->key = NULL;
kfree(priv->wilc_ptk[key_index]->seq);
@@ -1216,8 +1216,8 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
sinfo->tx_failed = stats.tx_fail_cnt;
sinfo->txrate.legacy = stats.link_speed * 10;

- if ((stats.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) &&
- (stats.link_speed != DEFAULT_LINK_SPEED))
+ if (stats.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH &&
+ stats.link_speed != DEFAULT_LINK_SPEED)
wilc_enable_tcp_ack_filter(true);
else if (stats.link_speed != DEFAULT_LINK_SPEED)
wilc_enable_tcp_ack_filter(false);
@@ -1893,7 +1893,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
static int start_ap(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_ap_settings *settings)
{
- struct cfg80211_beacon_data *beacon = &(settings->beacon);
+ struct cfg80211_beacon_data *beacon = &settings->beacon;
struct wilc_priv *priv;
s32 ret = 0;
struct wilc *wl;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index ac76bc7..acaeafc 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -693,7 +693,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
i = 0;
do {
tqe = wilc_wlan_txq_remove_from_head(dev);
- if (tqe && (vmm_table[i] != 0)) {
+ if (tqe && vmm_table[i] != 0) {
u32 header, buffer_offset;

vmm_table[i] = cpu_to_le32(vmm_table[i]);
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 19e4f85..aeb5417 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -235,7 +235,7 @@ static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 siz
buf[2] = (u8)size;
buf[3] = (u8)(size >> 8);

- if ((str) && (size != 0))
+ if (str && size != 0)
memcpy(&buf[4], str, size);

return (size + 4);
@@ -256,7 +256,7 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size)
buf[2] = (u8)size;
buf[3] = (u8)(size >> 8);

- if ((b) && (size != 0)) {
+ if ((b) && size != 0) {
memcpy(&buf[4], b, size);
for (i = 0; i < size; i++)
checksum += buf[i + 4];
@@ -370,7 +370,7 @@ static int wilc_wlan_parse_info_frame(u8 *info, int size)

len = info[2];

- if ((len == 1) && (wid == WID_STATUS)) {
+ if (len == 1 && wid == WID_STATUS) {
pd->mac_status = info[3];
type = WILC_CFG_RSP_STATUS;
}
--
2.7.4

2018-01-22 11:22:47

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef

On Mon, Jan 22, 2018 at 01:06:59PM +0200, Claudiu Beznea wrote:
>
>
> On 22.01.2018 12:22, Ajay Singh wrote:
> > Fix the "do not add new typedefs" issue found by checkpatch.pl
> > script
> >
> >From https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
> the the message body line is wrapped at 75 columns.
>

I normally consider 75 characters a maximum. I wrap at 72 characters
like a normal email.

If we get too hung up on procedures for their own sake then it makes
sending patches a real pain. There are some people I just don't send
patches to because they are too much headache to deal with.

regards,
dan carpenter

2018-01-22 10:23:25

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 10/14] staging: wilc1000: rename ptstrJoinBssParam variable to avoid camelCase

Fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 78 +++++++++++++++----------------
1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4856d4f..c3b6368 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -909,7 +909,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
u8 *cur_byte = NULL;
- struct join_bss_param *ptstrJoinBssParam;
+ struct join_bss_param *bss_param;
struct host_if_drv *hif_drv = vif->hif_drv;

if (memcmp(attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
@@ -918,8 +918,8 @@ static s32 Handle_Connect(struct wilc_vif *vif,
return result;
}

- ptstrJoinBssParam = attr->params;
- if (!ptstrJoinBssParam) {
+ bss_param = attr->params;
+ if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
@@ -1027,8 +1027,8 @@ static s32 Handle_Connect(struct wilc_vif *vif,
netdev_err(vif->ndev, "Channel out of range\n");
*(cur_byte++) = 0xFF;
}
- *(cur_byte++) = (ptstrJoinBssParam->cap_info) & 0xFF;
- *(cur_byte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
+ *(cur_byte++) = (bss_param->cap_info) & 0xFF;
+ *(cur_byte++) = ((bss_param->cap_info) >> 8) & 0xFF;

if (attr->bssid)
memcpy(cur_byte, attr->bssid, 6);
@@ -1038,57 +1038,57 @@ static s32 Handle_Connect(struct wilc_vif *vif,
memcpy(cur_byte, attr->bssid, 6);
cur_byte += 6;

- *(cur_byte++) = (ptstrJoinBssParam->beacon_period) & 0xFF;
- *(cur_byte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
- *(cur_byte++) = ptstrJoinBssParam->dtim_period;
+ *(cur_byte++) = (bss_param->beacon_period) & 0xFF;
+ *(cur_byte++) = ((bss_param->beacon_period) >> 8) & 0xFF;
+ *(cur_byte++) = bss_param->dtim_period;

- memcpy(cur_byte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1);
+ memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1);
cur_byte += (MAX_RATES_SUPPORTED + 1);

- *(cur_byte++) = ptstrJoinBssParam->wmm_cap;
- *(cur_byte++) = ptstrJoinBssParam->uapsd_cap;
+ *(cur_byte++) = bss_param->wmm_cap;
+ *(cur_byte++) = bss_param->uapsd_cap;

- *(cur_byte++) = ptstrJoinBssParam->ht_capable;
- hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable;
+ *(cur_byte++) = bss_param->ht_capable;
+ hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable;

- *(cur_byte++) = ptstrJoinBssParam->rsn_found;
- *(cur_byte++) = ptstrJoinBssParam->rsn_grp_policy;
- *(cur_byte++) = ptstrJoinBssParam->mode_802_11i;
+ *(cur_byte++) = bss_param->rsn_found;
+ *(cur_byte++) = bss_param->rsn_grp_policy;
+ *(cur_byte++) = bss_param->mode_802_11i;

- memcpy(cur_byte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy));
- cur_byte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
+ memcpy(cur_byte, bss_param->rsn_pcip_policy, sizeof(bss_param->rsn_pcip_policy));
+ cur_byte += sizeof(bss_param->rsn_pcip_policy);

- memcpy(cur_byte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy));
- cur_byte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
+ memcpy(cur_byte, bss_param->rsn_auth_policy, sizeof(bss_param->rsn_auth_policy));
+ cur_byte += sizeof(bss_param->rsn_auth_policy);

- memcpy(cur_byte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap));
- cur_byte += sizeof(ptstrJoinBssParam->rsn_cap);
+ memcpy(cur_byte, bss_param->rsn_cap, sizeof(bss_param->rsn_cap));
+ cur_byte += sizeof(bss_param->rsn_cap);

*(cur_byte++) = REAL_JOIN_REQ;
- *(cur_byte++) = ptstrJoinBssParam->noa_enabled;
+ *(cur_byte++) = bss_param->noa_enabled;

- if (ptstrJoinBssParam->noa_enabled) {
- *(cur_byte++) = (ptstrJoinBssParam->tsf) & 0xFF;
- *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF;
- *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
- *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
+ if (bss_param->noa_enabled) {
+ *(cur_byte++) = (bss_param->tsf) & 0xFF;
+ *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF;
+ *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF;
+ *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF;

- *(cur_byte++) = ptstrJoinBssParam->opp_enabled;
- *(cur_byte++) = ptstrJoinBssParam->idx;
+ *(cur_byte++) = bss_param->opp_enabled;
+ *(cur_byte++) = bss_param->idx;

- if (ptstrJoinBssParam->opp_enabled)
- *(cur_byte++) = ptstrJoinBssParam->ct_window;
+ if (bss_param->opp_enabled)
+ *(cur_byte++) = bss_param->ct_window;

- *(cur_byte++) = ptstrJoinBssParam->cnt;
+ *(cur_byte++) = bss_param->cnt;

- memcpy(cur_byte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration));
- cur_byte += sizeof(ptstrJoinBssParam->duration);
+ memcpy(cur_byte, bss_param->duration, sizeof(bss_param->duration));
+ cur_byte += sizeof(bss_param->duration);

- memcpy(cur_byte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval));
- cur_byte += sizeof(ptstrJoinBssParam->interval);
+ memcpy(cur_byte, bss_param->interval, sizeof(bss_param->interval));
+ cur_byte += sizeof(bss_param->interval);

- memcpy(cur_byte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time));
- cur_byte += sizeof(ptstrJoinBssParam->start_time);
+ memcpy(cur_byte, bss_param->start_time, sizeof(bss_param->start_time));
+ cur_byte += sizeof(bss_param->start_time);
}

cur_byte = wid_list[wid_cnt].val;
--
2.7.4

2018-01-22 10:23:19

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 08/14] staging: wilc1000: rename pu8CurrByte variable to avoid camelCase

Fix "Avoid camelCase" issue reported by checkpatch.pl script.
rename variable name from "pu8CurrByte" to "cur_byte"

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 232 +++++++++++++++---------------
1 file changed, 116 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 496c72f..43f8559 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -908,7 +908,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
s32 result = 0;
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
- u8 *pu8CurrByte = NULL;
+ u8 *cur_byte = NULL;
struct join_bss_param *ptstrJoinBssParam;
struct host_if_drv *hif_drv = vif->hif_drv;

@@ -1016,90 +1016,90 @@ static s32 Handle_Connect(struct wilc_vif *vif,
goto ERRORHANDLER;
}

- pu8CurrByte = wid_list[wid_cnt].val;
+ cur_byte = wid_list[wid_cnt].val;

if (pstrHostIFconnectAttr->ssid) {
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
- pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0';
+ memcpy(cur_byte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
+ cur_byte[pstrHostIFconnectAttr->ssid_len] = '\0';
}
- pu8CurrByte += MAX_SSID_LEN;
- *(pu8CurrByte++) = INFRASTRUCTURE;
+ cur_byte += MAX_SSID_LEN;
+ *(cur_byte++) = INFRASTRUCTURE;

if (pstrHostIFconnectAttr->ch >= 1 && pstrHostIFconnectAttr->ch <= 14) {
- *(pu8CurrByte++) = pstrHostIFconnectAttr->ch;
+ *(cur_byte++) = pstrHostIFconnectAttr->ch;
} else {
netdev_err(vif->ndev, "Channel out of range\n");
- *(pu8CurrByte++) = 0xFF;
+ *(cur_byte++) = 0xFF;
}
- *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF;
- *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
+ *(cur_byte++) = (ptstrJoinBssParam->cap_info) & 0xFF;
+ *(cur_byte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;

if (pstrHostIFconnectAttr->bssid)
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
- pu8CurrByte += 6;
+ memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
+ cur_byte += 6;

if (pstrHostIFconnectAttr->bssid)
- memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
- pu8CurrByte += 6;
+ memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
+ cur_byte += 6;

- *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF;
- *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
- *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period;
+ *(cur_byte++) = (ptstrJoinBssParam->beacon_period) & 0xFF;
+ *(cur_byte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
+ *(cur_byte++) = ptstrJoinBssParam->dtim_period;

- memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1);
- pu8CurrByte += (MAX_RATES_SUPPORTED + 1);
+ memcpy(cur_byte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1);
+ cur_byte += (MAX_RATES_SUPPORTED + 1);

- *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap;
- *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap;
+ *(cur_byte++) = ptstrJoinBssParam->wmm_cap;
+ *(cur_byte++) = ptstrJoinBssParam->uapsd_cap;

- *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable;
+ *(cur_byte++) = ptstrJoinBssParam->ht_capable;
hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable;

- *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found;
- *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy;
- *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i;
+ *(cur_byte++) = ptstrJoinBssParam->rsn_found;
+ *(cur_byte++) = ptstrJoinBssParam->rsn_grp_policy;
+ *(cur_byte++) = ptstrJoinBssParam->mode_802_11i;

- memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy));
- pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
+ memcpy(cur_byte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy));
+ cur_byte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);

- memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy));
- pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
+ memcpy(cur_byte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy));
+ cur_byte += sizeof(ptstrJoinBssParam->rsn_auth_policy);

- memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap));
- pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap);
+ memcpy(cur_byte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap));
+ cur_byte += sizeof(ptstrJoinBssParam->rsn_cap);

- *(pu8CurrByte++) = REAL_JOIN_REQ;
- *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled;
+ *(cur_byte++) = REAL_JOIN_REQ;
+ *(cur_byte++) = ptstrJoinBssParam->noa_enabled;

if (ptstrJoinBssParam->noa_enabled) {
- *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF;
- *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF;
- *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
- *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
+ *(cur_byte++) = (ptstrJoinBssParam->tsf) & 0xFF;
+ *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF;
+ *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
+ *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;

- *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled;
- *(pu8CurrByte++) = ptstrJoinBssParam->idx;
+ *(cur_byte++) = ptstrJoinBssParam->opp_enabled;
+ *(cur_byte++) = ptstrJoinBssParam->idx;

if (ptstrJoinBssParam->opp_enabled)
- *(pu8CurrByte++) = ptstrJoinBssParam->ct_window;
+ *(cur_byte++) = ptstrJoinBssParam->ct_window;

- *(pu8CurrByte++) = ptstrJoinBssParam->cnt;
+ *(cur_byte++) = ptstrJoinBssParam->cnt;

- memcpy(pu8CurrByte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration));
- pu8CurrByte += sizeof(ptstrJoinBssParam->duration);
+ memcpy(cur_byte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration));
+ cur_byte += sizeof(ptstrJoinBssParam->duration);

- memcpy(pu8CurrByte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval));
- pu8CurrByte += sizeof(ptstrJoinBssParam->interval);
+ memcpy(cur_byte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval));
+ cur_byte += sizeof(ptstrJoinBssParam->interval);

- memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time));
- pu8CurrByte += sizeof(ptstrJoinBssParam->start_time);
+ memcpy(cur_byte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time));
+ cur_byte += sizeof(ptstrJoinBssParam->start_time);
}

- pu8CurrByte = wid_list[wid_cnt].val;
+ cur_byte = wid_list[wid_cnt].val;
wid_cnt++;

if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
- memcpy(join_req, pu8CurrByte, join_req_size);
+ memcpy(join_req, cur_byte, join_req_size);
join_req_vif = vif;
}

@@ -1161,7 +1161,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
kfree(pstrHostIFconnectAttr->ies);
pstrHostIFconnectAttr->ies = NULL;

- kfree(pu8CurrByte);
+ kfree(cur_byte);
return result;
}

@@ -1992,7 +1992,7 @@ static void Handle_AddBeacon(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_ADD_BEACON;
wid.type = WID_BIN;
@@ -2001,33 +2001,33 @@ static void Handle_AddBeacon(struct wilc_vif *vif,
if (!wid.val)
goto ERRORHANDLER;

- pu8CurrByte = wid.val;
- *pu8CurrByte++ = (pstrSetBeaconParam->interval & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF);
+ cur_byte = wid.val;
+ *cur_byte++ = (pstrSetBeaconParam->interval & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF);

- *pu8CurrByte++ = (pstrSetBeaconParam->dtim_period & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF);
+ *cur_byte++ = (pstrSetBeaconParam->dtim_period & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF);

- *pu8CurrByte++ = (pstrSetBeaconParam->head_len & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF);
+ *cur_byte++ = (pstrSetBeaconParam->head_len & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF);

- memcpy(pu8CurrByte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len);
- pu8CurrByte += pstrSetBeaconParam->head_len;
+ memcpy(cur_byte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len);
+ cur_byte += pstrSetBeaconParam->head_len;

- *pu8CurrByte++ = (pstrSetBeaconParam->tail_len & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF);
- *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF);
+ *cur_byte++ = (pstrSetBeaconParam->tail_len & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF);
+ *cur_byte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF);

if (pstrSetBeaconParam->tail)
- memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
- pu8CurrByte += pstrSetBeaconParam->tail_len;
+ memcpy(cur_byte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
+ cur_byte += pstrSetBeaconParam->tail_len;

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
@@ -2044,7 +2044,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif)
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_DEL_BEACON;
wid.type = WID_CHAR;
@@ -2054,7 +2054,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif)
if (!wid.val)
return;

- pu8CurrByte = wid.val;
+ cur_byte = wid.val;

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
@@ -2065,34 +2065,34 @@ static void Handle_DelBeacon(struct wilc_vif *vif)
static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer,
struct add_sta_param *pstrStationParam)
{
- u8 *pu8CurrByte;
+ u8 *cur_byte;

- pu8CurrByte = pu8Buffer;
+ cur_byte = pu8Buffer;

- memcpy(pu8CurrByte, pstrStationParam->bssid, ETH_ALEN);
- pu8CurrByte += ETH_ALEN;
+ memcpy(cur_byte, pstrStationParam->bssid, ETH_ALEN);
+ cur_byte += ETH_ALEN;

- *pu8CurrByte++ = pstrStationParam->aid & 0xFF;
- *pu8CurrByte++ = (pstrStationParam->aid >> 8) & 0xFF;
+ *cur_byte++ = pstrStationParam->aid & 0xFF;
+ *cur_byte++ = (pstrStationParam->aid >> 8) & 0xFF;

- *pu8CurrByte++ = pstrStationParam->rates_len;
+ *cur_byte++ = pstrStationParam->rates_len;
if (pstrStationParam->rates_len > 0)
- memcpy(pu8CurrByte, pstrStationParam->rates,
+ memcpy(cur_byte, pstrStationParam->rates,
pstrStationParam->rates_len);
- pu8CurrByte += pstrStationParam->rates_len;
+ cur_byte += pstrStationParam->rates_len;

- *pu8CurrByte++ = pstrStationParam->ht_supported;
- memcpy(pu8CurrByte, &pstrStationParam->ht_capa,
+ *cur_byte++ = pstrStationParam->ht_supported;
+ memcpy(cur_byte, &pstrStationParam->ht_capa,
sizeof(struct ieee80211_ht_cap));
- pu8CurrByte += sizeof(struct ieee80211_ht_cap);
+ cur_byte += sizeof(struct ieee80211_ht_cap);

- *pu8CurrByte++ = pstrStationParam->flags_mask & 0xFF;
- *pu8CurrByte++ = (pstrStationParam->flags_mask >> 8) & 0xFF;
+ *cur_byte++ = pstrStationParam->flags_mask & 0xFF;
+ *cur_byte++ = (pstrStationParam->flags_mask >> 8) & 0xFF;

- *pu8CurrByte++ = pstrStationParam->flags_set & 0xFF;
- *pu8CurrByte++ = (pstrStationParam->flags_set >> 8) & 0xFF;
+ *cur_byte++ = pstrStationParam->flags_set & 0xFF;
+ *cur_byte++ = (pstrStationParam->flags_set >> 8) & 0xFF;

- return pu8CurrByte - pu8Buffer;
+ return cur_byte - pu8Buffer;
}

static void Handle_AddStation(struct wilc_vif *vif,
@@ -2100,7 +2100,7 @@ static void Handle_AddStation(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_ADD_STA;
wid.type = WID_BIN;
@@ -2110,8 +2110,8 @@ static void Handle_AddStation(struct wilc_vif *vif,
if (!wid.val)
goto ERRORHANDLER;

- pu8CurrByte = wid.val;
- pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
+ cur_byte = wid.val;
+ cur_byte += WILC_HostIf_PackStaParam(cur_byte, pstrStationParam);

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
@@ -2169,7 +2169,7 @@ static void Handle_DelStation(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_REMOVE_STA;
wid.type = WID_BIN;
@@ -2179,9 +2179,9 @@ static void Handle_DelStation(struct wilc_vif *vif,
if (!wid.val)
goto ERRORHANDLER;

- pu8CurrByte = wid.val;
+ cur_byte = wid.val;

- ether_addr_copy(pu8CurrByte, pstrDelStaParam->mac_addr);
+ ether_addr_copy(cur_byte, pstrDelStaParam->mac_addr);

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
@@ -2197,7 +2197,7 @@ static void Handle_EditStation(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_EDIT_STA;
wid.type = WID_BIN;
@@ -2207,8 +2207,8 @@ static void Handle_EditStation(struct wilc_vif *vif,
if (!wid.val)
goto ERRORHANDLER;

- pu8CurrByte = wid.val;
- pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
+ cur_byte = wid.val;
+ cur_byte += WILC_HostIf_PackStaParam(cur_byte, pstrStationParam);

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
@@ -2294,7 +2294,7 @@ static int Handle_RegisterFrame(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_REGISTER_FRAME;
wid.type = WID_STR;
@@ -2302,11 +2302,11 @@ static int Handle_RegisterFrame(struct wilc_vif *vif,
if (!wid.val)
return -ENOMEM;

- pu8CurrByte = wid.val;
+ cur_byte = wid.val;

- *pu8CurrByte++ = pstrHostIfRegisterFrame->reg;
- *pu8CurrByte++ = pstrHostIfRegisterFrame->reg_id;
- memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->frame_type, sizeof(u16));
+ *cur_byte++ = pstrHostIfRegisterFrame->reg;
+ *cur_byte++ = pstrHostIfRegisterFrame->reg_id;
+ memcpy(cur_byte, &pstrHostIfRegisterFrame->frame_type, sizeof(u16));

wid.size = sizeof(u16) + 2;

@@ -2410,7 +2410,7 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif,
{
s32 result = 0;
struct wid wid;
- u8 *pu8CurrByte;
+ u8 *cur_byte;

wid.id = (u16)WID_SETUP_MULTICAST_FILTER;
wid.type = WID_BIN;
@@ -2419,19 +2419,19 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif,
if (!wid.val)
goto ERRORHANDLER;

- pu8CurrByte = wid.val;
- *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF);
- *pu8CurrByte++ = 0;
- *pu8CurrByte++ = 0;
- *pu8CurrByte++ = 0;
+ cur_byte = wid.val;
+ *cur_byte++ = (strHostIfSetMulti->enabled & 0xFF);
+ *cur_byte++ = 0;
+ *cur_byte++ = 0;
+ *cur_byte++ = 0;

- *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF);
- *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF);
+ *cur_byte++ = (strHostIfSetMulti->cnt & 0xFF);
+ *cur_byte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);
+ *cur_byte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF);
+ *cur_byte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF);

if ((strHostIfSetMulti->cnt) > 0)
- memcpy(pu8CurrByte, wilc_multicast_mac_addr_list,
+ memcpy(cur_byte, wilc_multicast_mac_addr_list,
((strHostIfSetMulti->cnt) * ETH_ALEN));

result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
--
2.7.4

2018-01-22 11:32:22

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef



On 22.01.2018 13:22, Dan Carpenter wrote:
> On Mon, Jan 22, 2018 at 01:06:59PM +0200, Claudiu Beznea wrote:
>>
>>
>> On 22.01.2018 12:22, Ajay Singh wrote:
>>> Fix the "do not add new typedefs" issue found by checkpatch.pl
>>> script
>>>
>> >From https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
>> the the message body line is wrapped at 75 columns.
>>
>
> I normally consider 75 characters a maximum. I wrap at 72 characters
> like a normal email.
>
> If we get too hung up on procedures for their own sake then it makes
> sending patches a real pain.
I agree with you. This is not my intention even it may look this way with
my previous comments. Was just a note. My bad, next time I'll have to
specify this.

Thank you,
Claudiu Beznea

There are some people I just don't send
> patches to because they are too much headache to deal with.>
> regards,
> dan carpenter
>
>

2018-01-22 10:23:22

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 09/14] staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid camelCase

Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 105 ++++++++++++++----------------
1 file changed, 49 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 43f8559..4856d4f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -903,7 +903,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,

u8 wilc_connected_ssid[6] = {0};
static s32 Handle_Connect(struct wilc_vif *vif,
- struct connect_attr *pstrHostIFconnectAttr)
+ struct connect_attr *attr)
{
s32 result = 0;
struct wid wid_list[8];
@@ -912,45 +912,41 @@ static s32 Handle_Connect(struct wilc_vif *vif,
struct join_bss_param *ptstrJoinBssParam;
struct host_if_drv *hif_drv = vif->hif_drv;

- if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
+ if (memcmp(attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
result = 0;
netdev_err(vif->ndev, "Discard connect request\n");
return result;
}

- ptstrJoinBssParam = pstrHostIFconnectAttr->params;
+ ptstrJoinBssParam = attr->params;
if (!ptstrJoinBssParam) {
netdev_err(vif->ndev, "Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
}

- if (pstrHostIFconnectAttr->bssid) {
+ if (attr->bssid) {
hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
- memcpy(hif_drv->usr_conn_req.bssid, pstrHostIFconnectAttr->bssid, 6);
+ memcpy(hif_drv->usr_conn_req.bssid, attr->bssid, 6);
}

- hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len;
- if (pstrHostIFconnectAttr->ssid) {
- hif_drv->usr_conn_req.ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
- memcpy(hif_drv->usr_conn_req.ssid,
- pstrHostIFconnectAttr->ssid,
- pstrHostIFconnectAttr->ssid_len);
- hif_drv->usr_conn_req.ssid[pstrHostIFconnectAttr->ssid_len] = '\0';
+ hif_drv->usr_conn_req.ssid_len = attr->ssid_len;
+ if (attr->ssid) {
+ hif_drv->usr_conn_req.ssid = kmalloc(attr->ssid_len + 1, GFP_KERNEL);
+ memcpy(hif_drv->usr_conn_req.ssid, attr->ssid, attr->ssid_len);
+ hif_drv->usr_conn_req.ssid[attr->ssid_len] = '\0';
}

- hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len;
- if (pstrHostIFconnectAttr->ies) {
- hif_drv->usr_conn_req.ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
- memcpy(hif_drv->usr_conn_req.ies,
- pstrHostIFconnectAttr->ies,
- pstrHostIFconnectAttr->ies_len);
+ hif_drv->usr_conn_req.ies_len = attr->ies_len;
+ if (attr->ies) {
+ hif_drv->usr_conn_req.ies = kmalloc(attr->ies_len, GFP_KERNEL);
+ memcpy(hif_drv->usr_conn_req.ies, attr->ies, attr->ies_len);
}

- hif_drv->usr_conn_req.security = pstrHostIFconnectAttr->security;
- hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type;
- hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
- hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;
+ hif_drv->usr_conn_req.security = attr->security;
+ hif_drv->usr_conn_req.auth_type = attr->auth_type;
+ hif_drv->usr_conn_req.conn_result = attr->result;
+ hif_drv->usr_conn_req.arg = attr->arg;

wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
wid_list[wid_cnt].type = WID_INT;
@@ -977,7 +973,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
wid_cnt++;

- if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ if (memcmp("DIRECT-", attr->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,
@@ -990,7 +986,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
wid_cnt++;

- if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
+ if (memcmp("DIRECT-", attr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;

wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
@@ -999,7 +995,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
wid_cnt++;

- if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
+ if (memcmp("DIRECT-", attr->ssid, 7))
auth_type = (u8)hif_drv->usr_conn_req.auth_type;

wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
@@ -1007,7 +1003,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].size = 112;
wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);

- if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ if (memcmp("DIRECT-", attr->ssid, 7)) {
join_req_size = wid_list[wid_cnt].size;
join_req = kmalloc(join_req_size, GFP_KERNEL);
}
@@ -1018,15 +1014,15 @@ static s32 Handle_Connect(struct wilc_vif *vif,

cur_byte = wid_list[wid_cnt].val;

- if (pstrHostIFconnectAttr->ssid) {
- memcpy(cur_byte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len);
- cur_byte[pstrHostIFconnectAttr->ssid_len] = '\0';
+ if (attr->ssid) {
+ memcpy(cur_byte, attr->ssid, attr->ssid_len);
+ cur_byte[attr->ssid_len] = '\0';
}
cur_byte += MAX_SSID_LEN;
*(cur_byte++) = INFRASTRUCTURE;

- if (pstrHostIFconnectAttr->ch >= 1 && pstrHostIFconnectAttr->ch <= 14) {
- *(cur_byte++) = pstrHostIFconnectAttr->ch;
+ if (attr->ch >= 1 && attr->ch <= 14) {
+ *(cur_byte++) = attr->ch;
} else {
netdev_err(vif->ndev, "Channel out of range\n");
*(cur_byte++) = 0xFF;
@@ -1034,12 +1030,12 @@ static s32 Handle_Connect(struct wilc_vif *vif,
*(cur_byte++) = (ptstrJoinBssParam->cap_info) & 0xFF;
*(cur_byte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;

- if (pstrHostIFconnectAttr->bssid)
- memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
+ if (attr->bssid)
+ memcpy(cur_byte, attr->bssid, 6);
cur_byte += 6;

- if (pstrHostIFconnectAttr->bssid)
- memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
+ if (attr->bssid)
+ memcpy(cur_byte, attr->bssid, 6);
cur_byte += 6;

*(cur_byte++) = (ptstrJoinBssParam->beacon_period) & 0xFF;
@@ -1098,14 +1094,13 @@ static s32 Handle_Connect(struct wilc_vif *vif,
cur_byte = wid_list[wid_cnt].val;
wid_cnt++;

- if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+ if (memcmp("DIRECT-", attr->ssid, 7)) {
memcpy(join_req, cur_byte, join_req_size);
join_req_vif = vif;
}

- if (pstrHostIFconnectAttr->bssid)
- memcpy(wilc_connected_ssid,
- pstrHostIFconnectAttr->bssid, ETH_ALEN);
+ if (attr->bssid)
+ memcpy(wilc_connected_ssid,attr->bssid, ETH_ALEN);

result = wilc_send_config_pkt(vif, SET_CFG, wid_list,
wid_cnt,
@@ -1126,23 +1121,21 @@ static s32 Handle_Connect(struct wilc_vif *vif,

memset(&strConnectInfo, 0, sizeof(struct connect_info));

- if (pstrHostIFconnectAttr->result) {
- if (pstrHostIFconnectAttr->bssid)
- memcpy(strConnectInfo.bssid, pstrHostIFconnectAttr->bssid, 6);
+ if (attr->result) {
+ if (attr->bssid)
+ memcpy(strConnectInfo.bssid, attr->bssid, 6);

- if (pstrHostIFconnectAttr->ies) {
- strConnectInfo.req_ies_len = pstrHostIFconnectAttr->ies_len;
- strConnectInfo.req_ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
- memcpy(strConnectInfo.req_ies,
- pstrHostIFconnectAttr->ies,
- pstrHostIFconnectAttr->ies_len);
+ if (attr->ies) {
+ strConnectInfo.req_ies_len = attr->ies_len;
+ strConnectInfo.req_ies = kmalloc(attr->ies_len, GFP_KERNEL);
+ memcpy(strConnectInfo.req_ies, attr->ies, attr->ies_len);
}

- pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP,
+ attr->result(CONN_DISCONN_EVENT_CONN_RESP,
&strConnectInfo,
MAC_DISCONNECTED,
NULL,
- pstrHostIFconnectAttr->arg);
+ attr->arg);
hif_drv->hif_state = HOST_IF_IDLE;
kfree(strConnectInfo.req_ies);
strConnectInfo.req_ies = NULL;
@@ -1152,14 +1145,14 @@ static s32 Handle_Connect(struct wilc_vif *vif,
}
}

- kfree(pstrHostIFconnectAttr->bssid);
- pstrHostIFconnectAttr->bssid = NULL;
+ kfree(attr->bssid);
+ attr->bssid = NULL;

- kfree(pstrHostIFconnectAttr->ssid);
- pstrHostIFconnectAttr->ssid = NULL;
+ kfree(attr->ssid);
+ attr->ssid = NULL;

- kfree(pstrHostIFconnectAttr->ies);
- pstrHostIFconnectAttr->ies = NULL;
+ kfree(attr->ies);
+ attr->ies = NULL;

kfree(cur_byte);
return result;
--
2.7.4

2018-01-22 10:23:31

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2 12/14] staging: wilc1000: rename Handle_ScanDone() to avoid camelCase

Fix "Avoid camelCase" issue reported by checkpatch.pl
script.

Signed-off-by: Ajay Singh <[email protected]>
Reviewed-by: Claudiu Beznea <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 0eaf6c6..b34243c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -267,7 +267,7 @@ static struct wilc_vif *join_req_vif;

static void *host_int_parse_join_bss_param(struct network_info *info);
static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-static s32 Handle_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
+static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event enuEvent);
static void host_if_work(struct work_struct *work);

/*!
@@ -847,7 +847,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
ERRORHANDLER:
if (result) {
del_timer(&hif_drv->scan_timer);
- Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
+ handle_scan_done(vif, SCAN_EVENT_ABORTED);
}

kfree(scan_info->ch_freq_list);
@@ -863,8 +863,8 @@ static s32 handle_scan(struct wilc_vif *vif, struct scan_attr *scan_info)
return result;
}

-static s32 Handle_ScanDone(struct wilc_vif *vif,
- enum scan_event enuEvent)
+static s32 handle_scan_done(struct wilc_vif *vif,
+ enum scan_event enuEvent)
{
s32 result = 0;
u8 u8abort_running_scan;
@@ -1460,7 +1460,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,

if (hif_drv->usr_scan_req.scan_result) {
del_timer(&hif_drv->scan_timer);
- Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
+ handle_scan_done(vif, SCAN_EVENT_ABORTED);
}

strDisconnectNotifInfo.reason = 0;
@@ -1508,7 +1508,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
(hif_drv->usr_scan_req.scan_result)) {
del_timer(&hif_drv->scan_timer);
if (hif_drv->usr_scan_req.scan_result)
- Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
+ handle_scan_done(vif, SCAN_EVENT_ABORTED);
}
}

@@ -2525,7 +2525,7 @@ static void host_if_work(struct work_struct *work)
if (!wilc_wlan_get_num_conn_ifcs(wilc))
wilc_chip_sleep_manually(wilc);

- Handle_ScanDone(msg->vif, SCAN_EVENT_DONE);
+ handle_scan_done(msg->vif, SCAN_EVENT_DONE);

if (msg->vif->hif_drv->remain_on_ch_pending)
Handle_RemainOnChan(msg->vif,
@@ -2567,7 +2567,7 @@ static void host_if_work(struct work_struct *work)
break;

case HOST_IF_MSG_SCAN_TIMER_FIRED:
- Handle_ScanDone(msg->vif, SCAN_EVENT_ABORTED);
+ handle_scan_done(msg->vif, SCAN_EVENT_ABORTED);
break;

case HOST_IF_MSG_CONNECT_TIMER_FIRED:
--
2.7.4

2018-01-30 14:36:39

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

On Tue, Jan 30, 2018 at 02:13:53AM +0800, kbuild test robot wrote:
> Hi Ajay,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on staging/staging-testing]
> [cannot apply to v4.15 next-20180126]
> [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/Ajay-Singh/fix-to-remove-unnecessary-parenthesis-typedef-and-avoid-camelCase/20180123-115314
>
> New smatch warnings:
> drivers/staging/wilc1000/host_interface.c:937 handle_connect() error: potential null dereference 'hif_drv->usr_conn_req.ssid'. (kmalloc returns null)
>

It's not really a new warning, it's just that we renamed variables. But
that's fine because it's a real bug and we should fix it.

What I don't understand is that this warning was introduced in patch 9
so I don't know why the script is responding to patch 13. I would have
expect it to reply to patch 9 (because that's where the warning is
introduced) or patch 0 or patch 14 (if it's testing the whole patchset
instead of individual patches).

regards,
dan carpenter