All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: r8188eu: cleanup of style and typos
@ 2022-04-06  8:30 Rebecca Mckeever
  2022-04-06  8:30 ` [PATCH 1/4] staging: r8188eu: format comments in drivers/net style Rebecca Mckeever
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Rebecca Mckeever @ 2022-04-06  8:30 UTC (permalink / raw)
  To: outreachy
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
	linux-kernel, Rebecca Mckeever

These patches address style issues and typos found by checkpatch
or suggested by Dan Carpenter or Larry Finger.

Rebecca Mckeever (4):
  staging: r8188eu: format comments in drivers/net style
  staging: r8188eu: remove extra 'the'
  staging: r8188eu: correct misspelling in comment 'tppe' -> 'type'
  staging: r8188eu: use sizeof(*pvar) for allocating structs

 drivers/staging/r8188eu/core/rtw_cmd.c | 81 +++++++++++++-------------
 1 file changed, 39 insertions(+), 42 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] staging: r8188eu: format comments in drivers/net style
  2022-04-06  8:30 [PATCH 0/4] staging: r8188eu: cleanup of style and typos Rebecca Mckeever
@ 2022-04-06  8:30 ` Rebecca Mckeever
  2022-04-06  8:30 ` [PATCH 2/4] staging: r8188eu: remove extra 'the' Rebecca Mckeever
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Rebecca Mckeever @ 2022-04-06  8:30 UTC (permalink / raw)
  To: outreachy
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
	linux-kernel, Rebecca Mckeever

Format comments according to the Linux kernerl coding style
for drivers/net so they do not need to be reformatted after
this driver is accepted into the drivers/net tree.

Suggested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_cmd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 9b53b92c6795..9f5ece52bd39 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -11,8 +11,7 @@
 #include "../include/rtw_mlme_ext.h"
 #include "../include/rtl8188e_dm.h"
 
-/*
- * Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
+/* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
  * No irqsave is necessary.
  */
 
@@ -96,8 +95,7 @@ static void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv)
 	}
 }
 
-/*
- * Calling Context:
+/* Calling Context:
  *
  * rtw_enqueue_cmd can only be called between kernel thread,
  * since only spin_lock is used.
@@ -317,8 +315,7 @@ int rtw_cmd_thread(void *context)
 	return 0;
 }
 
-/*
- * rtw_sitesurvey_cmd(~)
+/* rtw_sitesurvey_cmd(~)
  *	### NOTE:#### (!!!!)
  *	MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
  */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] staging: r8188eu: remove extra 'the'
  2022-04-06  8:30 [PATCH 0/4] staging: r8188eu: cleanup of style and typos Rebecca Mckeever
  2022-04-06  8:30 ` [PATCH 1/4] staging: r8188eu: format comments in drivers/net style Rebecca Mckeever
@ 2022-04-06  8:30 ` Rebecca Mckeever
  2022-04-06 22:32   ` Alison Schofield
  2022-04-06  8:30 ` [PATCH 3/4] staging: r8188eu: correct misspelling in comment 'tppe' -> 'type' Rebecca Mckeever
  2022-04-06  8:31 ` [PATCH 4/4] staging: r8188eu: use sizeof(*pvar) for allocating structs Rebecca Mckeever
  3 siblings, 1 reply; 8+ messages in thread
From: Rebecca Mckeever @ 2022-04-06  8:30 UTC (permalink / raw)
  To: outreachy
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
	linux-kernel, Rebecca Mckeever

Remove repeated 'the' in comment to be grammatically correct and
conform to Linux kernel coding style.

Found with checkpatch:
WARNING: Possible repeated word: 'the'

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 9f5ece52bd39..cd20811ae152 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -519,7 +519,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct wlan_network *pnetwork)
 
 	psecnetwork->IELength = 0;
 	/*  Added by Albert 2009/02/18 */
-	/*  If the the driver wants to use the bssid to create the connection. */
+	/*  If the driver wants to use the bssid to create the connection. */
 	/*  If not,  we have to copy the connecting AP's MAC address to it so that */
 	/*  the driver just has the bssid information for PMKIDList searching. */
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] staging: r8188eu: correct misspelling in comment 'tppe' -> 'type'
  2022-04-06  8:30 [PATCH 0/4] staging: r8188eu: cleanup of style and typos Rebecca Mckeever
  2022-04-06  8:30 ` [PATCH 1/4] staging: r8188eu: format comments in drivers/net style Rebecca Mckeever
  2022-04-06  8:30 ` [PATCH 2/4] staging: r8188eu: remove extra 'the' Rebecca Mckeever
@ 2022-04-06  8:30 ` Rebecca Mckeever
  2022-04-06 18:37   ` Dave Jiang
  2022-04-06  8:31 ` [PATCH 4/4] staging: r8188eu: use sizeof(*pvar) for allocating structs Rebecca Mckeever
  3 siblings, 1 reply; 8+ messages in thread
From: Rebecca Mckeever @ 2022-04-06  8:30 UTC (permalink / raw)
  To: outreachy
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
	linux-kernel, Rebecca Mckeever, Dan Carpenter

Correct spelling typo.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index cd20811ae152..f4a277e6b654 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1162,7 +1162,7 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType)
 	}
 
 	pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID;
-	pdrvextra_cmd_parm->type_size = intCmdType;	/*	As the command tppe. */
+	pdrvextra_cmd_parm->type_size = intCmdType;	/*	As the command type. */
 	pdrvextra_cmd_parm->pbuf = NULL;		/*	Must be NULL here */
 
 	init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] staging: r8188eu: use sizeof(*pvar) for allocating structs
  2022-04-06  8:30 [PATCH 0/4] staging: r8188eu: cleanup of style and typos Rebecca Mckeever
                   ` (2 preceding siblings ...)
  2022-04-06  8:30 ` [PATCH 3/4] staging: r8188eu: correct misspelling in comment 'tppe' -> 'type' Rebecca Mckeever
@ 2022-04-06  8:31 ` Rebecca Mckeever
  2022-04-14 23:43   ` Ira Weiny
  3 siblings, 1 reply; 8+ messages in thread
From: Rebecca Mckeever @ 2022-04-06  8:31 UTC (permalink / raw)
  To: outreachy
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
	linux-kernel, Rebecca Mckeever

Use sizeof(*pvar) instead of sizeof(struct var) when allocating memory.
This conforms to Linux kernel coding style, improves readability,
and decreases the opportunity for bugs if the pointer variable type is
changed. Issue found by checkpatch messages of the following format:

CHECK: Prefer kzalloc(sizeof(*pvar)...) over kzalloc(sizeof(struct var)...)

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_cmd.c | 68 +++++++++++++-------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index f4a277e6b654..110959148648 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -334,11 +334,11 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct ndis_802_11_ssid *ssid,
 	if (check_fwstate(pmlmepriv, _FW_LINKED))
 		p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1);
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c)
 		return _FAIL;
 
-	psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC);
+	psurveyPara = kzalloc(sizeof(*psurveyPara), GFP_ATOMIC);
 	if (!psurveyPara) {
 		kfree(ph2c);
 		return _FAIL;
@@ -399,13 +399,13 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
 	struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pbsetdataratepara = kzalloc(sizeof(struct setdatarate_parm), GFP_ATOMIC);
+	pbsetdataratepara = kzalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC);
 	if (!pbsetdataratepara) {
 		kfree(ph2c);
 		res = _FAIL;
@@ -438,7 +438,7 @@ u8 rtw_createbss_cmd(struct adapter  *padapter)
 
 	rtw_led_control(padapter, LED_CTL_START_TO_LINK);
 
-	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	pcmd = kzalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (!pcmd) {
 		res = _FAIL;
 		goto exit;
@@ -475,7 +475,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct wlan_network *pnetwork)
 
 	rtw_led_control(padapter, LED_CTL_START_TO_LINK);
 
-	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	pcmd = kzalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (!pcmd) {
 		res = _FAIL;
 		goto exit;
@@ -624,12 +624,12 @@ u8 rtw_setopmode_cmd(struct adapter  *padapter, enum ndis_802_11_network_infra n
 	struct	cmd_priv   *pcmdpriv = &padapter->cmdpriv;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
 	if (!ph2c) {
 		res = false;
 		goto exit;
 	}
-	psetop = kzalloc(sizeof(struct setopmode_parm), GFP_KERNEL);
+	psetop = kzalloc(sizeof(*psetop), GFP_KERNEL);
 
 	if (!psetop) {
 		kfree(ph2c);
@@ -659,20 +659,20 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key)
 	struct sta_info *sta = (struct sta_info *)psta;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL);
+	psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL);
 	if (!psetstakey_para) {
 		kfree(ph2c);
 		res = _FAIL;
 		goto exit;
 	}
 
-	psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_KERNEL);
+	psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp), GFP_KERNEL);
 	if (!psetstakey_rsp) {
 		kfree(ph2c);
 		kfree(psetstakey_para);
@@ -718,13 +718,13 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
 	if (!enqueue) {
 		clear_cam_entry(padapter, entry);
 	} else {
-		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+		ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 		if (!ph2c) {
 			res = _FAIL;
 			goto exit;
 		}
 
-		psetstakey_para = kzalloc(sizeof(struct set_stakey_parm),
+		psetstakey_para = kzalloc(sizeof(*psetstakey_para),
 					  GFP_ATOMIC);
 		if (!psetstakey_para) {
 			kfree(ph2c);
@@ -732,7 +732,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
 			goto exit;
 		}
 
-		psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp),
+		psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp),
 					 GFP_ATOMIC);
 		if (!psetstakey_rsp) {
 			kfree(ph2c);
@@ -765,13 +765,13 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr)
 	struct addBaReq_parm *paddbareq_parm;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	paddbareq_parm = kzalloc(sizeof(struct addBaReq_parm), GFP_ATOMIC);
+	paddbareq_parm = kzalloc(sizeof(*paddbareq_parm), GFP_ATOMIC);
 	if (!paddbareq_parm) {
 		kfree(ph2c);
 		res = _FAIL;
@@ -798,13 +798,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
 	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
+	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
 	if (!pdrvextra_cmd_parm) {
 		kfree(ph2c);
 		res = _FAIL;
@@ -839,7 +839,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan)
 	}
 
 	/* prepare cmd parameter */
-	setChannelPlan_param = kzalloc(sizeof(struct SetChannelPlan_param),
+	setChannelPlan_param = kzalloc(sizeof(*setChannelPlan_param),
 				       GFP_KERNEL);
 	if (!setChannelPlan_param) {
 		res = _FAIL;
@@ -848,7 +848,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan)
 	setChannelPlan_param->channel_plan = chplan;
 
 	/* need enqueue, prepare cmd_obj and enqueue */
-	pcmdobj = kzalloc(sizeof(struct	cmd_obj), GFP_KERNEL);
+	pcmdobj = kzalloc(sizeof(*pcmdobj), GFP_KERNEL);
 	if (!pcmdobj) {
 		kfree(setChannelPlan_param);
 		res = _FAIL;
@@ -1010,13 +1010,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)
 	/*	return res; */
 
 	if (enqueue) {
-		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+		ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 		if (!ph2c) {
 			res = _FAIL;
 			goto exit;
 		}
 
-		pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
+		pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm),
 					     GFP_ATOMIC);
 		if (!pdrvextra_cmd_parm) {
 			kfree(ph2c);
@@ -1056,13 +1056,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time)
 
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
+	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm),
 				     GFP_ATOMIC);
 	if (!pdrvextra_cmd_parm) {
 		kfree(ph2c);
@@ -1109,13 +1109,13 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue)
 		return res;
 
 	if (enqueue) {
-		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
+		ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
 		if (!ph2c) {
 			res = _FAIL;
 			goto exit;
 		}
 
-		pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
+		pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm),
 					     GFP_KERNEL);
 		if (!pdrvextra_cmd_parm) {
 			kfree(ph2c);
@@ -1148,13 +1148,13 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType)
 	if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
 		return res;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
+	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
 	if (!pdrvextra_cmd_parm) {
 		kfree(ph2c);
 		res = _FAIL;
@@ -1182,13 +1182,13 @@ u8 rtw_ps_cmd(struct adapter *padapter)
 
 	u8	res = _SUCCESS;
 
-	ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ppscmd = kzalloc(sizeof(*ppscmd), GFP_ATOMIC);
 	if (!ppscmd) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
+	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
 	if (!pdrvextra_cmd_parm) {
 		kfree(ppscmd);
 		res = _FAIL;
@@ -1253,13 +1253,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
 	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
+	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
 	if (!pdrvextra_cmd_parm) {
 		kfree(ph2c);
 		res = _FAIL;
@@ -1284,13 +1284,13 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
 	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
 	u8	res = _SUCCESS;
 
-	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
+	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
 	if (!ph2c) {
 		res = _FAIL;
 		goto exit;
 	}
 
-	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
+	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
 	if (!pdrvextra_cmd_parm) {
 		kfree(ph2c);
 		res = _FAIL;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] staging: r8188eu: correct misspelling in comment 'tppe' -> 'type'
  2022-04-06  8:30 ` [PATCH 3/4] staging: r8188eu: correct misspelling in comment 'tppe' -> 'type' Rebecca Mckeever
@ 2022-04-06 18:37   ` Dave Jiang
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Jiang @ 2022-04-06 18:37 UTC (permalink / raw)
  To: Rebecca Mckeever, outreachy
  Cc: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
	linux-kernel, Dan Carpenter


On 4/6/2022 1:30 AM, Rebecca Mckeever wrote:
> Correct spelling typo.
>
> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
> ---
>   drivers/staging/r8188eu/core/rtw_cmd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
> index cd20811ae152..f4a277e6b654 100644
> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
> @@ -1162,7 +1162,7 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType)
>   	}
>   
>   	pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID;
> -	pdrvextra_cmd_parm->type_size = intCmdType;	/*	As the command tppe. */
> +	pdrvextra_cmd_parm->type_size = intCmdType;	/*	As the command type. */

Nothing to do with this patch. Just saw intCmdType. Suggest another 
patch to fix this mixed case function parameter. Maybe cmd_type instead?


>   	pdrvextra_cmd_parm->pbuf = NULL;		/*	Must be NULL here */
>   
>   	init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] staging: r8188eu: remove extra 'the'
  2022-04-06  8:30 ` [PATCH 2/4] staging: r8188eu: remove extra 'the' Rebecca Mckeever
@ 2022-04-06 22:32   ` Alison Schofield
  0 siblings, 0 replies; 8+ messages in thread
From: Alison Schofield @ 2022-04-06 22:32 UTC (permalink / raw)
  To: Rebecca Mckeever
  Cc: outreachy, Larry Finger, Phillip Potter, Greg Kroah-Hartman,
	linux-staging, linux-kernel

On Wed, Apr 06, 2022 at 03:30:58AM -0500, Rebecca Mckeever wrote:
> Remove repeated 'the' in comment to be grammatically correct and
> conform to Linux kernel coding style.
> 
> Found with checkpatch:
> WARNING: Possible repeated word: 'the'
> 
> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
> ---
>  drivers/staging/r8188eu/core/rtw_cmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
> index 9f5ece52bd39..cd20811ae152 100644
> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
> @@ -519,7 +519,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct wlan_network *pnetwork)
>  
>  	psecnetwork->IELength = 0;
>  	/*  Added by Albert 2009/02/18 */

I don't know if this type of thing "Added by Albert" is sprinkled through
the file, but it seems they can be removed. Git will keep history of
this file from here on. (And in case anyone asks what happened to
Albert's notations, they can find that in the git history too ;))


> -	/*  If the the driver wants to use the bssid to create the connection. */
> +	/*  If the driver wants to use the bssid to create the connection. */
>  	/*  If not,  we have to copy the connecting AP's MAC address to it so that */
>  	/*  the driver just has the bssid information for PMKIDList searching. */
>  
> -- 
> 2.32.0
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/4] staging: r8188eu: use sizeof(*pvar) for allocating structs
  2022-04-06  8:31 ` [PATCH 4/4] staging: r8188eu: use sizeof(*pvar) for allocating structs Rebecca Mckeever
@ 2022-04-14 23:43   ` Ira Weiny
  0 siblings, 0 replies; 8+ messages in thread
From: Ira Weiny @ 2022-04-14 23:43 UTC (permalink / raw)
  To: Rebecca Mckeever
  Cc: outreachy, Larry Finger, Phillip Potter, Greg Kroah-Hartman,
	linux-staging, linux-kernel

On Wed, Apr 06, 2022 at 03:31:00AM -0500, Rebecca Mckeever wrote:
> Use sizeof(*pvar) instead of sizeof(struct var) when allocating memory.
> This conforms to Linux kernel coding style, improves readability,
> and decreases the opportunity for bugs if the pointer variable type is
> changed. Issue found by checkpatch messages of the following format:
> 
> CHECK: Prefer kzalloc(sizeof(*pvar)...) over kzalloc(sizeof(struct var)...)
> 
> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  drivers/staging/r8188eu/core/rtw_cmd.c | 68 +++++++++++++-------------
>  1 file changed, 34 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
> index f4a277e6b654..110959148648 100644
> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
> @@ -334,11 +334,11 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct ndis_802_11_ssid *ssid,
>  	if (check_fwstate(pmlmepriv, _FW_LINKED))
>  		p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1);
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c)
>  		return _FAIL;
>  
> -	psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC);
> +	psurveyPara = kzalloc(sizeof(*psurveyPara), GFP_ATOMIC);
>  	if (!psurveyPara) {
>  		kfree(ph2c);
>  		return _FAIL;
> @@ -399,13 +399,13 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
>  	struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pbsetdataratepara = kzalloc(sizeof(struct setdatarate_parm), GFP_ATOMIC);
> +	pbsetdataratepara = kzalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC);
>  	if (!pbsetdataratepara) {
>  		kfree(ph2c);
>  		res = _FAIL;
> @@ -438,7 +438,7 @@ u8 rtw_createbss_cmd(struct adapter  *padapter)
>  
>  	rtw_led_control(padapter, LED_CTL_START_TO_LINK);
>  
> -	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	pcmd = kzalloc(sizeof(*pcmd), GFP_ATOMIC);
>  	if (!pcmd) {
>  		res = _FAIL;
>  		goto exit;
> @@ -475,7 +475,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct wlan_network *pnetwork)
>  
>  	rtw_led_control(padapter, LED_CTL_START_TO_LINK);
>  
> -	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	pcmd = kzalloc(sizeof(*pcmd), GFP_ATOMIC);
>  	if (!pcmd) {
>  		res = _FAIL;
>  		goto exit;
> @@ -624,12 +624,12 @@ u8 rtw_setopmode_cmd(struct adapter  *padapter, enum ndis_802_11_network_infra n
>  	struct	cmd_priv   *pcmdpriv = &padapter->cmdpriv;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
>  	if (!ph2c) {
>  		res = false;
>  		goto exit;
>  	}
> -	psetop = kzalloc(sizeof(struct setopmode_parm), GFP_KERNEL);
> +	psetop = kzalloc(sizeof(*psetop), GFP_KERNEL);
>  
>  	if (!psetop) {
>  		kfree(ph2c);
> @@ -659,20 +659,20 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key)
>  	struct sta_info *sta = (struct sta_info *)psta;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL);
> +	psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL);
>  	if (!psetstakey_para) {
>  		kfree(ph2c);
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_KERNEL);
> +	psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp), GFP_KERNEL);
>  	if (!psetstakey_rsp) {
>  		kfree(ph2c);
>  		kfree(psetstakey_para);
> @@ -718,13 +718,13 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
>  	if (!enqueue) {
>  		clear_cam_entry(padapter, entry);
>  	} else {
> -		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +		ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  		if (!ph2c) {
>  			res = _FAIL;
>  			goto exit;
>  		}
>  
> -		psetstakey_para = kzalloc(sizeof(struct set_stakey_parm),
> +		psetstakey_para = kzalloc(sizeof(*psetstakey_para),
>  					  GFP_ATOMIC);
>  		if (!psetstakey_para) {
>  			kfree(ph2c);
> @@ -732,7 +732,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
>  			goto exit;
>  		}
>  
> -		psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp),
> +		psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp),
>  					 GFP_ATOMIC);
>  		if (!psetstakey_rsp) {
>  			kfree(ph2c);
> @@ -765,13 +765,13 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr)
>  	struct addBaReq_parm *paddbareq_parm;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	paddbareq_parm = kzalloc(sizeof(struct addBaReq_parm), GFP_ATOMIC);
> +	paddbareq_parm = kzalloc(sizeof(*paddbareq_parm), GFP_ATOMIC);
>  	if (!paddbareq_parm) {
>  		kfree(ph2c);
>  		res = _FAIL;
> @@ -798,13 +798,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
>  	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
> +	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
>  	if (!pdrvextra_cmd_parm) {
>  		kfree(ph2c);
>  		res = _FAIL;
> @@ -839,7 +839,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan)
>  	}
>  
>  	/* prepare cmd parameter */
> -	setChannelPlan_param = kzalloc(sizeof(struct SetChannelPlan_param),
> +	setChannelPlan_param = kzalloc(sizeof(*setChannelPlan_param),
>  				       GFP_KERNEL);
>  	if (!setChannelPlan_param) {
>  		res = _FAIL;
> @@ -848,7 +848,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan)
>  	setChannelPlan_param->channel_plan = chplan;
>  
>  	/* need enqueue, prepare cmd_obj and enqueue */
> -	pcmdobj = kzalloc(sizeof(struct	cmd_obj), GFP_KERNEL);
> +	pcmdobj = kzalloc(sizeof(*pcmdobj), GFP_KERNEL);
>  	if (!pcmdobj) {
>  		kfree(setChannelPlan_param);
>  		res = _FAIL;
> @@ -1010,13 +1010,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)
>  	/*	return res; */
>  
>  	if (enqueue) {
> -		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +		ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  		if (!ph2c) {
>  			res = _FAIL;
>  			goto exit;
>  		}
>  
> -		pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
> +		pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm),
>  					     GFP_ATOMIC);
>  		if (!pdrvextra_cmd_parm) {
>  			kfree(ph2c);
> @@ -1056,13 +1056,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time)
>  
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
> +	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm),
>  				     GFP_ATOMIC);
>  	if (!pdrvextra_cmd_parm) {
>  		kfree(ph2c);
> @@ -1109,13 +1109,13 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue)
>  		return res;
>  
>  	if (enqueue) {
> -		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
> +		ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
>  		if (!ph2c) {
>  			res = _FAIL;
>  			goto exit;
>  		}
>  
> -		pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
> +		pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm),
>  					     GFP_KERNEL);
>  		if (!pdrvextra_cmd_parm) {
>  			kfree(ph2c);
> @@ -1148,13 +1148,13 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType)
>  	if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
>  		return res;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
> +	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
>  	if (!pdrvextra_cmd_parm) {
>  		kfree(ph2c);
>  		res = _FAIL;
> @@ -1182,13 +1182,13 @@ u8 rtw_ps_cmd(struct adapter *padapter)
>  
>  	u8	res = _SUCCESS;
>  
> -	ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ppscmd = kzalloc(sizeof(*ppscmd), GFP_ATOMIC);
>  	if (!ppscmd) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
> +	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
>  	if (!pdrvextra_cmd_parm) {
>  		kfree(ppscmd);
>  		res = _FAIL;
> @@ -1253,13 +1253,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
>  	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
> +	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
>  	if (!pdrvextra_cmd_parm) {
>  		kfree(ph2c);
>  		res = _FAIL;
> @@ -1284,13 +1284,13 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
>  	struct cmd_priv	*pcmdpriv = &padapter->cmdpriv;
>  	u8	res = _SUCCESS;
>  
> -	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> +	ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
>  	if (!ph2c) {
>  		res = _FAIL;
>  		goto exit;
>  	}
>  
> -	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
> +	pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
>  	if (!pdrvextra_cmd_parm) {
>  		kfree(ph2c);
>  		res = _FAIL;
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-14 23:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06  8:30 [PATCH 0/4] staging: r8188eu: cleanup of style and typos Rebecca Mckeever
2022-04-06  8:30 ` [PATCH 1/4] staging: r8188eu: format comments in drivers/net style Rebecca Mckeever
2022-04-06  8:30 ` [PATCH 2/4] staging: r8188eu: remove extra 'the' Rebecca Mckeever
2022-04-06 22:32   ` Alison Schofield
2022-04-06  8:30 ` [PATCH 3/4] staging: r8188eu: correct misspelling in comment 'tppe' -> 'type' Rebecca Mckeever
2022-04-06 18:37   ` Dave Jiang
2022-04-06  8:31 ` [PATCH 4/4] staging: r8188eu: use sizeof(*pvar) for allocating structs Rebecca Mckeever
2022-04-14 23:43   ` Ira Weiny

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.