driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8712: fix checkpatch warnings
@ 2020-03-26  5:56 Aiman Najjar
  2020-03-27  8:04 ` Greg Kroah-Hartman
  2020-04-02  8:12 ` [PATCH] staging: rtl8712: fix checkpatch warnings Dan Carpenter
  0 siblings, 2 replies; 14+ messages in thread
From: Aiman Najjar @ 2020-03-26  5:56 UTC (permalink / raw)
  To: Larry Finger, Florian Schilhabel, Greg Kroah-Hartman, devel,
	linux-kernel

This patch fixes remaining warnings in rtl871x_xmit.c of
rtl8712 staging driver

The following warnings are resolved:

WARNING: line over 80 characters
\#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74:
+	* Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,

WARNING: line over 80 characters
\#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79:
+		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);

WARNING: line over 80 characters
\#129: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:129:
+		pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrptxmickey'
\#378: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:378:
+					psecuritypriv->
+					XGrptxmickey[psecuritypriv->

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
\#379: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:379:
+					XGrptxmickey[psecuritypriv->
+					XGrpKeyid].skey);

WARNING: Avoid multiple line dereference - prefer 'psta->sta_xmitpriv.txseq_tid[pattrib->priority]'
\#544: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:544:
+				pattrib->seqnum = psta->sta_xmitpriv.
+						 txseq_tid[pattrib->priority];

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->PrivacyKeyIndex'
\#636: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:636:
+					      (u8)psecuritypriv->
+					      PrivacyKeyIndex);

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
\#643: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:643:
+						   (u8)psecuritypriv->
+						   XGrpKeyid);

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
\#652: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:652:
+						   (u8)psecuritypriv->
+						   XGrpKeyid);

Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 85 +++++++++++++-------------
 1 file changed, 41 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index f0b85338b567..82df5e26f8c8 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -71,12 +71,13 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
 	_init_queue(&pxmitpriv->apsd_queue);
 	_init_queue(&pxmitpriv->free_xmit_queue);
 	/*
-	 * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
+	 * Please allocate memory with sz = (struct xmit_frame) * NR_XMITFRAME,
 	 * and initialize free_xmit_frame below.
 	 * Please also apply  free_txobj to link_up all the xmit_frames...
 	 */
 	pxmitpriv->pallocated_frame_buf =
-		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);
+		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4,
+			GFP_ATOMIC);
 	if (!pxmitpriv->pallocated_frame_buf) {
 		pxmitpriv->pxmit_frame_buf = NULL;
 		return -ENOMEM;
@@ -126,8 +127,8 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
 	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
 	for (i = 0; i < NR_XMITBUFF; i++) {
 		INIT_LIST_HEAD(&pxmitbuf->list);
-		pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,
-						   GFP_ATOMIC);
+		pxmitbuf->pallocated_buf =
+			kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ, GFP_ATOMIC);
 		if (!pxmitbuf->pallocated_buf)
 			return -ENOMEM;
 		pxmitbuf->pbuf = pxmitbuf->pallocated_buf + XMITBUF_ALIGN_SZ -
@@ -350,7 +351,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
 	struct	sta_info *stainfo;
 	struct	qos_priv *pqospriv = &(padapter->mlmepriv.qospriv);
 	struct	pkt_attrib  *pattrib = &pxmitframe->attrib;
-	struct	security_priv *psecuritypriv = &padapter->securitypriv;
+	struct	security_priv *psecpriv = &padapter->securitypriv;
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 	u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
 	bool bmcst = is_multicast_ether_addr(pattrib->ra);
@@ -368,15 +369,14 @@ static int xmitframe_addmic(struct _adapter *padapter,
 					   0x0, 0x0};
 			pframe = pxmitframe->buf_addr + TXDESC_OFFSET;
 			if (bmcst) {
-				if (!memcmp(psecuritypriv->XGrptxmickey
-				   [psecuritypriv->XGrpKeyid].skey,
+				if (!memcmp(psecpriv->XGrptxmickey
+				   [psecpriv->XGrpKeyid].skey,
 				   null_key, 16))
 					return -ENOMEM;
 				/*start to calculate the mic code*/
 				r8712_secmicsetkey(&micdata,
-					 psecuritypriv->
-					 XGrptxmickey[psecuritypriv->
-					XGrpKeyid].skey);
+					psecpriv->XGrptxmickey
+					[psecpriv->XGrpKeyid].skey);
 			} else {
 				if (!memcmp(&stainfo->tkiptxmickey.skey[0],
 					    null_key, 16))
@@ -416,7 +416,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
 					length = pattrib->last_txcmdsz -
 						  pattrib->hdrlen -
 						  pattrib->iv_len -
-						  ((psecuritypriv->sw_encrypt)
+						  ((psecpriv->sw_encrypt)
 						  ? pattrib->icv_len : 0);
 					r8712_secmicappend(&micdata, payload,
 							   length);
@@ -424,7 +424,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
 				} else {
 					length = pxmitpriv->frag_len -
 					    pattrib->hdrlen - pattrib->iv_len -
-					    ((psecuritypriv->sw_encrypt) ?
+					    ((psecpriv->sw_encrypt) ?
 					    pattrib->icv_len : 0);
 					r8712_secmicappend(&micdata, payload,
 							   length);
@@ -469,7 +469,7 @@ static sint xmitframe_swencrypt(struct _adapter *padapter,
 }
 
 static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
-			struct pkt_attrib *pattrib)
+			struct pkt_attrib *pattr)
 {
 	u16 *qc;
 
@@ -479,70 +479,70 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
 	__le16 *fctrl = &pwlanhdr->frame_ctl;
 
 	memset(hdr, 0, WLANHDR_OFFSET);
-	SetFrameSubType(fctrl, pattrib->subtype);
-	if (pattrib->subtype & WIFI_DATA_TYPE) {
+	SetFrameSubType(fctrl, pattr->subtype);
+	if (pattr->subtype & WIFI_DATA_TYPE) {
 		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
 			/* to_ds = 1, fr_ds = 0; */
 			SetToDs(fctrl);
 			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
 				ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
-			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr3, pattr->dst, ETH_ALEN);
 		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 			/* to_ds = 0, fr_ds = 1; */
 			SetFrDs(fctrl);
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
 			memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv),
 				ETH_ALEN);
-			memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr3, pattr->src, ETH_ALEN);
 		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
 			   check_fwstate(pmlmepriv,
 					 WIFI_ADHOC_MASTER_STATE)) {
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
 				ETH_ALEN);
 		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
 				ETH_ALEN);
 		} else {
 			return -EINVAL;
 		}
 
-		if (pattrib->encrypt)
+		if (pattr->encrypt)
 			SetPrivacy(fctrl);
 		if (pqospriv->qos_option) {
-			qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
-			if (pattrib->priority)
-				SetPriority(qc, pattrib->priority);
-			SetAckpolicy(qc, pattrib->ack_policy);
+			qc = (unsigned short *)(hdr + pattr->hdrlen - 2);
+			if (pattr->priority)
+				SetPriority(qc, pattr->priority);
+			SetAckpolicy(qc, pattr->ack_policy);
 		}
 		/* TODO: fill HT Control Field */
 		/* Update Seq Num will be handled by f/w */
 		{
 			struct sta_info *psta;
-			bool bmcst = is_multicast_ether_addr(pattrib->ra);
+			bool bmcst = is_multicast_ether_addr(pattr->ra);
 
-			if (pattrib->psta) {
-				psta = pattrib->psta;
+			if (pattr->psta) {
+				psta = pattr->psta;
 			} else {
 				if (bmcst)
 					psta = r8712_get_bcmc_stainfo(padapter);
 				else
 					psta =
 					 r8712_get_stainfo(&padapter->stapriv,
-					 pattrib->ra);
+					 pattr->ra);
 			}
 			if (psta) {
 				psta->sta_xmitpriv.txseq_tid
-						  [pattrib->priority]++;
-				psta->sta_xmitpriv.txseq_tid[pattrib->priority]
+						  [pattr->priority]++;
+				psta->sta_xmitpriv.txseq_tid[pattr->priority]
 						   &= 0xFFF;
-				pattrib->seqnum = psta->sta_xmitpriv.
-						  txseq_tid[pattrib->priority];
-				SetSeqNum(hdr, pattrib->seqnum);
+				pattr->seqnum =
+				  psta->sta_xmitpriv.txseq_tid[pattr->priority];
+				SetSeqNum(hdr, pattr->seqnum);
 			}
 		}
 	}
@@ -589,7 +589,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 	addr_t addr;
 	u8 *pframe, *mem_start, *ptxdesc;
 	struct sta_info		*psta;
-	struct security_priv	*psecuritypriv = &padapter->securitypriv;
+	struct security_priv	*psecpriv = &padapter->securitypriv;
 	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
 	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
 	struct pkt_attrib	*pattrib = &pxmitframe->attrib;
@@ -632,15 +632,13 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 				case _WEP40_:
 				case _WEP104_:
 					WEP_IV(pattrib->iv, psta->txpn,
-					       (u8)psecuritypriv->
-					       PrivacyKeyIndex);
+					       (u8)psecpriv->PrivacyKeyIndex);
 					break;
 				case _TKIP_:
 					if (bmcst)
 						TKIP_IV(pattrib->iv,
 						    psta->txpn,
-						    (u8)psecuritypriv->
-						    XGrpKeyid);
+						    (u8)psecpriv->XGrpKeyid);
 					else
 						TKIP_IV(pattrib->iv, psta->txpn,
 							0);
@@ -648,8 +646,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 				case _AES_:
 					if (bmcst)
 						AES_IV(pattrib->iv, psta->txpn,
-						    (u8)psecuritypriv->
-						    XGrpKeyid);
+						    (u8)psecpriv->XGrpKeyid);
 					else
 						AES_IV(pattrib->iv, psta->txpn,
 						       0);
-- 
2.20.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: rtl8712: fix checkpatch warnings
  2020-03-26  5:56 [PATCH] staging: rtl8712: fix checkpatch warnings Aiman Najjar
@ 2020-03-27  8:04 ` Greg Kroah-Hartman
  2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
  2020-04-02  8:12 ` [PATCH] staging: rtl8712: fix checkpatch warnings Dan Carpenter
  1 sibling, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-27  8:04 UTC (permalink / raw)
  To: Aiman Najjar; +Cc: devel, Florian Schilhabel, linux-kernel, Larry Finger

On Thu, Mar 26, 2020 at 01:56:16AM -0400, Aiman Najjar wrote:
> This patch fixes remaining warnings in rtl871x_xmit.c of
> rtl8712 staging driver
> 
> The following warnings are resolved:
> 
> WARNING: line over 80 characters
> \#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74:
> +	* Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
> 
> WARNING: line over 80 characters
> \#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79:
> +		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);
> 
> WARNING: line over 80 characters
> \#129: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:129:
> +		pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrptxmickey'
> \#378: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:378:
> +					psecuritypriv->
> +					XGrptxmickey[psecuritypriv->
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
> \#379: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:379:
> +					XGrptxmickey[psecuritypriv->
> +					XGrpKeyid].skey);
> 
> WARNING: Avoid multiple line dereference - prefer 'psta->sta_xmitpriv.txseq_tid[pattrib->priority]'
> \#544: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:544:
> +				pattrib->seqnum = psta->sta_xmitpriv.
> +						 txseq_tid[pattrib->priority];
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->PrivacyKeyIndex'
> \#636: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:636:
> +					      (u8)psecuritypriv->
> +					      PrivacyKeyIndex);
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
> \#643: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:643:
> +						   (u8)psecuritypriv->
> +						   XGrpKeyid);
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
> \#652: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:652:
> +						   (u8)psecuritypriv->
> +						   XGrpKeyid);
> 
> Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
> ---
>  drivers/staging/rtl8712/rtl871x_xmit.c | 85 +++++++++++++-------------
>  1 file changed, 41 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
> index f0b85338b567..82df5e26f8c8 100644
> --- a/drivers/staging/rtl8712/rtl871x_xmit.c
> +++ b/drivers/staging/rtl8712/rtl871x_xmit.c
> @@ -71,12 +71,13 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
>  	_init_queue(&pxmitpriv->apsd_queue);
>  	_init_queue(&pxmitpriv->free_xmit_queue);
>  	/*
> -	 * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
> +	 * Please allocate memory with sz = (struct xmit_frame) * NR_XMITFRAME,
>  	 * and initialize free_xmit_frame below.
>  	 * Please also apply  free_txobj to link_up all the xmit_frames...
>  	 */
>  	pxmitpriv->pallocated_frame_buf =
> -		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);
> +		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4,
> +			GFP_ATOMIC);
>  	if (!pxmitpriv->pallocated_frame_buf) {
>  		pxmitpriv->pxmit_frame_buf = NULL;
>  		return -ENOMEM;
> @@ -126,8 +127,8 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
>  	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
>  	for (i = 0; i < NR_XMITBUFF; i++) {
>  		INIT_LIST_HEAD(&pxmitbuf->list);
> -		pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,
> -						   GFP_ATOMIC);
> +		pxmitbuf->pallocated_buf =
> +			kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ, GFP_ATOMIC);
>  		if (!pxmitbuf->pallocated_buf)
>  			return -ENOMEM;
>  		pxmitbuf->pbuf = pxmitbuf->pallocated_buf + XMITBUF_ALIGN_SZ -
> @@ -350,7 +351,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
>  	struct	sta_info *stainfo;
>  	struct	qos_priv *pqospriv = &(padapter->mlmepriv.qospriv);
>  	struct	pkt_attrib  *pattrib = &pxmitframe->attrib;
> -	struct	security_priv *psecuritypriv = &padapter->securitypriv;
> +	struct	security_priv *psecpriv = &padapter->securitypriv;
>  	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
>  	u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
>  	bool bmcst = is_multicast_ether_addr(pattrib->ra);
> @@ -368,15 +369,14 @@ static int xmitframe_addmic(struct _adapter *padapter,
>  					   0x0, 0x0};
>  			pframe = pxmitframe->buf_addr + TXDESC_OFFSET;
>  			if (bmcst) {
> -				if (!memcmp(psecuritypriv->XGrptxmickey
> -				   [psecuritypriv->XGrpKeyid].skey,
> +				if (!memcmp(psecpriv->XGrptxmickey
> +				   [psecpriv->XGrpKeyid].skey,
>  				   null_key, 16))
>  					return -ENOMEM;
>  				/*start to calculate the mic code*/
>  				r8712_secmicsetkey(&micdata,
> -					 psecuritypriv->
> -					 XGrptxmickey[psecuritypriv->
> -					XGrpKeyid].skey);
> +					psecpriv->XGrptxmickey
> +					[psecpriv->XGrpKeyid].skey);
>  			} else {
>  				if (!memcmp(&stainfo->tkiptxmickey.skey[0],
>  					    null_key, 16))
> @@ -416,7 +416,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
>  					length = pattrib->last_txcmdsz -
>  						  pattrib->hdrlen -
>  						  pattrib->iv_len -
> -						  ((psecuritypriv->sw_encrypt)
> +						  ((psecpriv->sw_encrypt)
>  						  ? pattrib->icv_len : 0);
>  					r8712_secmicappend(&micdata, payload,
>  							   length);
> @@ -424,7 +424,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
>  				} else {
>  					length = pxmitpriv->frag_len -
>  					    pattrib->hdrlen - pattrib->iv_len -
> -					    ((psecuritypriv->sw_encrypt) ?
> +					    ((psecpriv->sw_encrypt) ?
>  					    pattrib->icv_len : 0);
>  					r8712_secmicappend(&micdata, payload,
>  							   length);
> @@ -469,7 +469,7 @@ static sint xmitframe_swencrypt(struct _adapter *padapter,
>  }
>  
>  static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
> -			struct pkt_attrib *pattrib)
> +			struct pkt_attrib *pattr)
>  {
>  	u16 *qc;
>  
> @@ -479,70 +479,70 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
>  	__le16 *fctrl = &pwlanhdr->frame_ctl;
>  
>  	memset(hdr, 0, WLANHDR_OFFSET);
> -	SetFrameSubType(fctrl, pattrib->subtype);
> -	if (pattrib->subtype & WIFI_DATA_TYPE) {
> +	SetFrameSubType(fctrl, pattr->subtype);
> +	if (pattr->subtype & WIFI_DATA_TYPE) {
>  		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
>  			/* to_ds = 1, fr_ds = 0; */
>  			SetToDs(fctrl);
>  			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
>  				ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
> +			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
> +			memcpy(pwlanhdr->addr3, pattr->dst, ETH_ALEN);
>  		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
>  			/* to_ds = 0, fr_ds = 1; */
>  			SetFrDs(fctrl);
> -			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
> +			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
>  			memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv),
>  				ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
> +			memcpy(pwlanhdr->addr3, pattr->src, ETH_ALEN);
>  		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
>  			   check_fwstate(pmlmepriv,
>  					 WIFI_ADHOC_MASTER_STATE)) {
> -			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> +			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
> +			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
>  			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
>  				ETH_ALEN);
>  		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> -			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> +			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
> +			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
>  			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
>  				ETH_ALEN);
>  		} else {
>  			return -EINVAL;
>  		}
>  
> -		if (pattrib->encrypt)
> +		if (pattr->encrypt)
>  			SetPrivacy(fctrl);
>  		if (pqospriv->qos_option) {
> -			qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
> -			if (pattrib->priority)
> -				SetPriority(qc, pattrib->priority);
> -			SetAckpolicy(qc, pattrib->ack_policy);
> +			qc = (unsigned short *)(hdr + pattr->hdrlen - 2);
> +			if (pattr->priority)
> +				SetPriority(qc, pattr->priority);
> +			SetAckpolicy(qc, pattr->ack_policy);
>  		}
>  		/* TODO: fill HT Control Field */
>  		/* Update Seq Num will be handled by f/w */
>  		{
>  			struct sta_info *psta;
> -			bool bmcst = is_multicast_ether_addr(pattrib->ra);
> +			bool bmcst = is_multicast_ether_addr(pattr->ra);
>  
> -			if (pattrib->psta) {
> -				psta = pattrib->psta;
> +			if (pattr->psta) {
> +				psta = pattr->psta;
>  			} else {
>  				if (bmcst)
>  					psta = r8712_get_bcmc_stainfo(padapter);
>  				else
>  					psta =
>  					 r8712_get_stainfo(&padapter->stapriv,
> -					 pattrib->ra);
> +					 pattr->ra);
>  			}
>  			if (psta) {
>  				psta->sta_xmitpriv.txseq_tid
> -						  [pattrib->priority]++;
> -				psta->sta_xmitpriv.txseq_tid[pattrib->priority]
> +						  [pattr->priority]++;
> +				psta->sta_xmitpriv.txseq_tid[pattr->priority]
>  						   &= 0xFFF;
> -				pattrib->seqnum = psta->sta_xmitpriv.
> -						  txseq_tid[pattrib->priority];
> -				SetSeqNum(hdr, pattrib->seqnum);
> +				pattr->seqnum =
> +				  psta->sta_xmitpriv.txseq_tid[pattr->priority];
> +				SetSeqNum(hdr, pattr->seqnum);
>  			}
>  		}
>  	}
> @@ -589,7 +589,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
>  	addr_t addr;
>  	u8 *pframe, *mem_start, *ptxdesc;
>  	struct sta_info		*psta;
> -	struct security_priv	*psecuritypriv = &padapter->securitypriv;
> +	struct security_priv	*psecpriv = &padapter->securitypriv;
>  	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
>  	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
>  	struct pkt_attrib	*pattrib = &pxmitframe->attrib;
> @@ -632,15 +632,13 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
>  				case _WEP40_:
>  				case _WEP104_:
>  					WEP_IV(pattrib->iv, psta->txpn,
> -					       (u8)psecuritypriv->
> -					       PrivacyKeyIndex);
> +					       (u8)psecpriv->PrivacyKeyIndex);
>  					break;
>  				case _TKIP_:
>  					if (bmcst)
>  						TKIP_IV(pattrib->iv,
>  						    psta->txpn,
> -						    (u8)psecuritypriv->
> -						    XGrpKeyid);
> +						    (u8)psecpriv->XGrpKeyid);
>  					else
>  						TKIP_IV(pattrib->iv, psta->txpn,
>  							0);
> @@ -648,8 +646,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
>  				case _AES_:
>  					if (bmcst)
>  						AES_IV(pattrib->iv, psta->txpn,
> -						    (u8)psecuritypriv->
> -						    XGrpKeyid);
> +						    (u8)psecpriv->XGrpKeyid);
>  					else
>  						AES_IV(pattrib->iv, psta->txpn,
>  						       0);
> -- 
> 2.20.1
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch did many different things all at once, making it difficult
  to review.  All Linux kernel patches need to only do one thing at a
  time.  If you need to do multiple things (such as clean up all coding
  style issues in a file/driver), do it in a sequence of patches, each
  one doing only one thing.  This will make it easier to review the
  patches to ensure that they are correct, and to help alleviate any
  merge issues that larger patches can cause.


If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings
  2020-03-27  8:04 ` Greg Kroah-Hartman
@ 2020-03-28  0:08   ` aimannajjar
  2020-03-28  0:08     ` [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning aimannajjar
                       ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: aimannajjar @ 2020-03-28  0:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, aimannajjar, Florian Schilhabel, linux-kernel, Larry Finger

This v2 of the patch breaks up the previous patch into
a patchset of smaller patches.

Overall, the patchset fixes the remaining 9 warnings
in rtl871x_xmit.c.

aimannajjar (5):
  staging: rtl8712: fix checkpatch long-line warning
  staging: rtl8712: fix long-line checkpatch warning
  staging: rtl8712: fix checkpatch warnings
  staging: rtl8712: fix multiline derefernce warning
  staging: rtl8712:fix multiline derefernce warnings

 drivers/staging/rtl8712/rtl871x_xmit.c | 85 +++++++++++++-------------
 1 file changed, 41 insertions(+), 44 deletions(-)

-- 
2.20.1


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning
  2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
@ 2020-03-28  0:08     ` aimannajjar
  2020-04-02  8:17       ` Dan Carpenter
  2020-04-02  8:19       ` Dan Carpenter
  2020-03-28  0:08     ` [PATCH v2 2/5] staging: rtl8712: fix long-line checkpatch warning aimannajjar
                       ` (3 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: aimannajjar @ 2020-03-28  0:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, aimannajjar, Florian Schilhabel, linux-kernel, Larry Finger

This patch fixes these two long-line checkpatch warnings
in rtl871x_xmit.c:

WARNING: line over 80 characters
\#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74:
+       * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,

WARNING: line over 80 characters
\#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79:
+               kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);

Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index f0b85338b567..628e4bad1547 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -71,12 +71,13 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
 	_init_queue(&pxmitpriv->apsd_queue);
 	_init_queue(&pxmitpriv->free_xmit_queue);
 	/*
-	 * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
+	 * Please allocate memory with sz = (struct xmit_frame) * NR_XMITFRAME,
 	 * and initialize free_xmit_frame below.
 	 * Please also apply  free_txobj to link_up all the xmit_frames...
 	 */
 	pxmitpriv->pallocated_frame_buf =
-		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);
+		kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4,
+			GFP_ATOMIC);
 	if (!pxmitpriv->pallocated_frame_buf) {
 		pxmitpriv->pxmit_frame_buf = NULL;
 		return -ENOMEM;
-- 
2.20.1


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2 2/5] staging: rtl8712: fix long-line checkpatch warning
  2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
  2020-03-28  0:08     ` [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning aimannajjar
@ 2020-03-28  0:08     ` aimannajjar
  2020-03-28  0:08     ` [PATCH v2 3/5] staging: rtl8712: fix checkpatch warnings aimannajjar
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: aimannajjar @ 2020-03-28  0:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, aimannajjar, Florian Schilhabel, linux-kernel, Larry Finger

This patch fixes the following warning in rtl871x_xmit.c:

WARNING: line over 80 characters
130: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:130:
+		pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,

Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 628e4bad1547..454c26f83406 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -127,8 +127,8 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
 	pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
 	for (i = 0; i < NR_XMITBUFF; i++) {
 		INIT_LIST_HEAD(&pxmitbuf->list);
-		pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,
-						   GFP_ATOMIC);
+		pxmitbuf->pallocated_buf =
+			kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ, GFP_ATOMIC);
 		if (!pxmitbuf->pallocated_buf)
 			return -ENOMEM;
 		pxmitbuf->pbuf = pxmitbuf->pallocated_buf + XMITBUF_ALIGN_SZ -
-- 
2.20.1


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2 3/5] staging: rtl8712: fix checkpatch warnings
  2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
  2020-03-28  0:08     ` [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning aimannajjar
  2020-03-28  0:08     ` [PATCH v2 2/5] staging: rtl8712: fix long-line checkpatch warning aimannajjar
@ 2020-03-28  0:08     ` aimannajjar
  2020-03-28  0:08     ` [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning aimannajjar
  2020-03-28  0:08     ` [PATCH v2 5/5] staging: rtl8712:fix multiline derefernce warnings aimannajjar
  4 siblings, 0 replies; 14+ messages in thread
From: aimannajjar @ 2020-03-28  0:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, aimannajjar, Florian Schilhabel, linux-kernel, Larry Finger

This patch fixes multiline dereference warnings in
rtl871x_xmit.c:

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrptxmickey'
379: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:379:
+					psecuritypriv->
+					XGrptxmickey[psecuritypriv->

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
380: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:380:
+					XGrptxmickey[psecuritypriv->
+					XGrpKeyid].skey);

Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 454c26f83406..0f789c821552 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -351,7 +351,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
 	struct	sta_info *stainfo;
 	struct	qos_priv *pqospriv = &(padapter->mlmepriv.qospriv);
 	struct	pkt_attrib  *pattrib = &pxmitframe->attrib;
-	struct	security_priv *psecuritypriv = &padapter->securitypriv;
+	struct	security_priv *psecpriv = &padapter->securitypriv;
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 	u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
 	bool bmcst = is_multicast_ether_addr(pattrib->ra);
@@ -369,15 +369,14 @@ static int xmitframe_addmic(struct _adapter *padapter,
 					   0x0, 0x0};
 			pframe = pxmitframe->buf_addr + TXDESC_OFFSET;
 			if (bmcst) {
-				if (!memcmp(psecuritypriv->XGrptxmickey
-				   [psecuritypriv->XGrpKeyid].skey,
+				if (!memcmp(psecpriv->XGrptxmickey
+				   [psecpriv->XGrpKeyid].skey,
 				   null_key, 16))
 					return -ENOMEM;
 				/*start to calculate the mic code*/
 				r8712_secmicsetkey(&micdata,
-					 psecuritypriv->
-					 XGrptxmickey[psecuritypriv->
-					XGrpKeyid].skey);
+					psecpriv->XGrptxmickey
+					[psecpriv->XGrpKeyid].skey);
 			} else {
 				if (!memcmp(&stainfo->tkiptxmickey.skey[0],
 					    null_key, 16))
@@ -417,7 +416,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
 					length = pattrib->last_txcmdsz -
 						  pattrib->hdrlen -
 						  pattrib->iv_len -
-						  ((psecuritypriv->sw_encrypt)
+						  ((psecpriv->sw_encrypt)
 						  ? pattrib->icv_len : 0);
 					r8712_secmicappend(&micdata, payload,
 							   length);
@@ -425,7 +424,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
 				} else {
 					length = pxmitpriv->frag_len -
 					    pattrib->hdrlen - pattrib->iv_len -
-					    ((psecuritypriv->sw_encrypt) ?
+					    ((psecpriv->sw_encrypt) ?
 					    pattrib->icv_len : 0);
 					r8712_secmicappend(&micdata, payload,
 							   length);
-- 
2.20.1


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning
  2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
                       ` (2 preceding siblings ...)
  2020-03-28  0:08     ` [PATCH v2 3/5] staging: rtl8712: fix checkpatch warnings aimannajjar
@ 2020-03-28  0:08     ` aimannajjar
  2020-03-28 19:17       ` Joe Perches
  2020-03-28  0:08     ` [PATCH v2 5/5] staging: rtl8712:fix multiline derefernce warnings aimannajjar
  4 siblings, 1 reply; 14+ messages in thread
From: aimannajjar @ 2020-03-28  0:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, aimannajjar, Florian Schilhabel, linux-kernel, Larry Finger

This patch fixes the following checkpatch warning in
rtl8712x_xmit.c:

WARNING: Avoid multiple line dereference - prefer 'psta->sta_xmitpriv.txseq_tid[pattrib->priority]'
544: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:544:
+				pattrib->seqnum = psta->sta_xmitpriv.
+						 txseq_tid[pattrib->priority];

Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 50 +++++++++++++-------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 0f789c821552..04da7b318340 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -469,7 +469,7 @@ static sint xmitframe_swencrypt(struct _adapter *padapter,
 }
 
 static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
-			struct pkt_attrib *pattrib)
+			struct pkt_attrib *pattr)
 {
 	u16 *qc;
 
@@ -479,70 +479,70 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
 	__le16 *fctrl = &pwlanhdr->frame_ctl;
 
 	memset(hdr, 0, WLANHDR_OFFSET);
-	SetFrameSubType(fctrl, pattrib->subtype);
-	if (pattrib->subtype & WIFI_DATA_TYPE) {
+	SetFrameSubType(fctrl, pattr->subtype);
+	if (pattr->subtype & WIFI_DATA_TYPE) {
 		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
 			/* to_ds = 1, fr_ds = 0; */
 			SetToDs(fctrl);
 			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
 				ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
-			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr3, pattr->dst, ETH_ALEN);
 		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 			/* to_ds = 0, fr_ds = 1; */
 			SetFrDs(fctrl);
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
 			memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv),
 				ETH_ALEN);
-			memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr3, pattr->src, ETH_ALEN);
 		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
 			   check_fwstate(pmlmepriv,
 					 WIFI_ADHOC_MASTER_STATE)) {
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
 				ETH_ALEN);
 		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
+			memcpy(pwlanhdr->addr1, pattr->dst, ETH_ALEN);
+			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
 				ETH_ALEN);
 		} else {
 			return -EINVAL;
 		}
 
-		if (pattrib->encrypt)
+		if (pattr->encrypt)
 			SetPrivacy(fctrl);
 		if (pqospriv->qos_option) {
-			qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
-			if (pattrib->priority)
-				SetPriority(qc, pattrib->priority);
-			SetAckpolicy(qc, pattrib->ack_policy);
+			qc = (unsigned short *)(hdr + pattr->hdrlen - 2);
+			if (pattr->priority)
+				SetPriority(qc, pattr->priority);
+			SetAckpolicy(qc, pattr->ack_policy);
 		}
 		/* TODO: fill HT Control Field */
 		/* Update Seq Num will be handled by f/w */
 		{
 			struct sta_info *psta;
-			bool bmcst = is_multicast_ether_addr(pattrib->ra);
+			bool bmcst = is_multicast_ether_addr(pattr->ra);
 
-			if (pattrib->psta) {
-				psta = pattrib->psta;
+			if (pattr->psta) {
+				psta = pattr->psta;
 			} else {
 				if (bmcst)
 					psta = r8712_get_bcmc_stainfo(padapter);
 				else
 					psta =
 					 r8712_get_stainfo(&padapter->stapriv,
-					 pattrib->ra);
+					 pattr->ra);
 			}
 			if (psta) {
 				psta->sta_xmitpriv.txseq_tid
-						  [pattrib->priority]++;
-				psta->sta_xmitpriv.txseq_tid[pattrib->priority]
+						  [pattr->priority]++;
+				psta->sta_xmitpriv.txseq_tid[pattr->priority]
 						   &= 0xFFF;
-				pattrib->seqnum = psta->sta_xmitpriv.
-						  txseq_tid[pattrib->priority];
-				SetSeqNum(hdr, pattrib->seqnum);
+				pattr->seqnum =
+				  psta->sta_xmitpriv.txseq_tid[pattr->priority];
+				SetSeqNum(hdr, pattr->seqnum);
 			}
 		}
 	}
-- 
2.20.1


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2 5/5] staging: rtl8712:fix multiline derefernce warnings
  2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
                       ` (3 preceding siblings ...)
  2020-03-28  0:08     ` [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning aimannajjar
@ 2020-03-28  0:08     ` aimannajjar
  4 siblings, 0 replies; 14+ messages in thread
From: aimannajjar @ 2020-03-28  0:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, aimannajjar, Florian Schilhabel, linux-kernel, Larry Finger

This patch fixes remaining checkpatch warnings
in rtl871x_xmit.c:

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->PrivacyKeyIndex'
636: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:636:
+					      (u8)psecuritypriv->
+					      PrivacyKeyIndex);

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
643: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:643:
+						   (u8)psecuritypriv->
+						   XGrpKeyid);

WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
652: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:652:
+						   (u8)psecuritypriv->
+						   XGrpKeyid);

Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
---
 drivers/staging/rtl8712/rtl871x_xmit.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 04da7b318340..82df5e26f8c8 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -589,7 +589,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 	addr_t addr;
 	u8 *pframe, *mem_start, *ptxdesc;
 	struct sta_info		*psta;
-	struct security_priv	*psecuritypriv = &padapter->securitypriv;
+	struct security_priv	*psecpriv = &padapter->securitypriv;
 	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
 	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
 	struct pkt_attrib	*pattrib = &pxmitframe->attrib;
@@ -632,15 +632,13 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 				case _WEP40_:
 				case _WEP104_:
 					WEP_IV(pattrib->iv, psta->txpn,
-					       (u8)psecuritypriv->
-					       PrivacyKeyIndex);
+					       (u8)psecpriv->PrivacyKeyIndex);
 					break;
 				case _TKIP_:
 					if (bmcst)
 						TKIP_IV(pattrib->iv,
 						    psta->txpn,
-						    (u8)psecuritypriv->
-						    XGrpKeyid);
+						    (u8)psecpriv->XGrpKeyid);
 					else
 						TKIP_IV(pattrib->iv, psta->txpn,
 							0);
@@ -648,8 +646,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 				case _AES_:
 					if (bmcst)
 						AES_IV(pattrib->iv, psta->txpn,
-						    (u8)psecuritypriv->
-						    XGrpKeyid);
+						    (u8)psecpriv->XGrpKeyid);
 					else
 						AES_IV(pattrib->iv, psta->txpn,
 						       0);
-- 
2.20.1


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning
  2020-03-28  0:08     ` [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning aimannajjar
@ 2020-03-28 19:17       ` Joe Perches
  2020-03-28 19:30         ` Aiman Najjar
  2020-04-02  8:16         ` Dan Carpenter
  0 siblings, 2 replies; 14+ messages in thread
From: Joe Perches @ 2020-03-28 19:17 UTC (permalink / raw)
  To: aimannajjar, Greg Kroah-Hartman
  Cc: devel, Florian Schilhabel, linux-kernel, Larry Finger

On Fri, 2020-03-27 at 20:08 -0400, aimannajjar wrote:
> This patch fixes the following checkpatch warning in
> rtl8712x_xmit.c:
> 
> WARNING: Avoid multiple line dereference - prefer 'psta->sta_xmitpriv.txseq_tid[pattrib->priority]'
> 544: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:544:
> +				pattrib->seqnum = psta->sta_xmitpriv.
> +						 txseq_tid[pattrib->priority];

It's always better to try to make the code clearer than
merely shut up checkpatch bleats.

> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
[]
> @@ -479,70 +479,70 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
>  	__le16 *fctrl = &pwlanhdr->frame_ctl;
>  
>  	memset(hdr, 0, WLANHDR_OFFSET);
> -	SetFrameSubType(fctrl, pattrib->subtype);
> -	if (pattrib->subtype & WIFI_DATA_TYPE) {
> +	SetFrameSubType(fctrl, pattr->subtype);
> +	if (pattr->subtype & WIFI_DATA_TYPE) {
> 

The whole following block could be outdented one level
by changing this test to

	if (!(pattr->subtype & WIFI_DATA_TYPE))
		return 0;

>  		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
>  			/* to_ds = 1, fr_ds = 0; */
>  			SetToDs(fctrl);
>  			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
>  				ETH_ALEN);
The repetitive call to get_bssid(pmlmepriv) could be saved
by performing it outside this test

	u8 bssid = get_bssid(pmlmepriv);

and then using bssid in each memcpy/ether_addr_copy

> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
> +			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
> +			memcpy(pwlanhdr->addr3, pattr->dst, ETH_ALEN);

All of these memcpy could probably use ether_addr_copy if

	struct pkt_attrib {
		...
		u8      dst[ETH_ALEN];
		...
	};

was changed to 

		u8	dst[ETH_ALEN] __aligned(2);
		

so these would be

			ether_addr_copy(pwlanhdr->addr2, pattr->src);

and pwlanhdr isn't a particularly valuable name
for an automatic either.  It's hungarian like.

So I would suggest something like the below that
avoids any long lines instead and also removes
unnecessary multi-line statements without renaming.

---
 drivers/staging/rtl8712/rtl871x_xmit.c | 123 ++++++++++++++++-----------------
 drivers/staging/rtl8712/rtl871x_xmit.h |   2 +-
 2 files changed, 61 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index f0b853..3961dae 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -477,75 +477,72 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct qos_priv *pqospriv = &pmlmepriv->qospriv;
 	__le16 *fctrl = &pwlanhdr->frame_ctl;
+	u8 *bssid;
 
 	memset(hdr, 0, WLANHDR_OFFSET);
 	SetFrameSubType(fctrl, pattrib->subtype);
-	if (pattrib->subtype & WIFI_DATA_TYPE) {
-		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
-			/* to_ds = 1, fr_ds = 0; */
-			SetToDs(fctrl);
-			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
-				ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
-			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
-		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
-			/* to_ds = 0, fr_ds = 1; */
-			SetFrDs(fctrl);
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv),
-				ETH_ALEN);
-			memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
-		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
-			   check_fwstate(pmlmepriv,
-					 WIFI_ADHOC_MASTER_STATE)) {
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
-			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
-				ETH_ALEN);
-		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
-			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
-			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
-			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
-				ETH_ALEN);
-		} else {
-			return -EINVAL;
-		}
+	if (!(pattrib->subtype & WIFI_DATA_TYPE))
+		return 0;
 
-		if (pattrib->encrypt)
-			SetPrivacy(fctrl);
-		if (pqospriv->qos_option) {
-			qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
-			if (pattrib->priority)
-				SetPriority(qc, pattrib->priority);
-			SetAckpolicy(qc, pattrib->ack_policy);
-		}
-		/* TODO: fill HT Control Field */
-		/* Update Seq Num will be handled by f/w */
-		{
-			struct sta_info *psta;
-			bool bmcst = is_multicast_ether_addr(pattrib->ra);
-
-			if (pattrib->psta) {
-				psta = pattrib->psta;
-			} else {
-				if (bmcst)
-					psta = r8712_get_bcmc_stainfo(padapter);
-				else
-					psta =
-					 r8712_get_stainfo(&padapter->stapriv,
-					 pattrib->ra);
-			}
-			if (psta) {
-				psta->sta_xmitpriv.txseq_tid
-						  [pattrib->priority]++;
-				psta->sta_xmitpriv.txseq_tid[pattrib->priority]
-						   &= 0xFFF;
-				pattrib->seqnum = psta->sta_xmitpriv.
-						  txseq_tid[pattrib->priority];
-				SetSeqNum(hdr, pattrib->seqnum);
-			}
+	bssid = get_bssid(pmlmepriv);
+
+	if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
+		/* to_ds = 1, fr_ds = 0; */
+		SetToDs(fctrl);
+		ether_addr_copy(pwlanhdr->addr1, bssid);
+		ether_addr_copy(pwlanhdr->addr2, pattrib->src);
+		ether_addr_copy(pwlanhdr->addr3, pattrib->dst);
+	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
+		/* to_ds = 0, fr_ds = 1; */
+		SetFrDs(fctrl);
+		ether_addr_copy(pwlanhdr->addr1, pattrib->dst);
+		ether_addr_copy(pwlanhdr->addr2, bssid);
+		ether_addr_copy(pwlanhdr->addr3, pattrib->src);
+	} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
+		   check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
+		ether_addr_copy(pwlanhdr->addr1, pattrib->dst);
+		ether_addr_copy(pwlanhdr->addr2, pattrib->src);
+		ether_addr_copy(pwlanhdr->addr3, bssid);
+	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
+		ether_addr_copy(pwlanhdr->addr1, pattrib->dst);
+		ether_addr_copy(pwlanhdr->addr2, pattrib->src);
+		ether_addr_copy(pwlanhdr->addr3, bssid);
+	} else {
+		return -EINVAL;
+	}
+
+	if (pattrib->encrypt)
+		SetPrivacy(fctrl);
+	if (pqospriv->qos_option) {
+		qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
+		if (pattrib->priority)
+			SetPriority(qc, pattrib->priority);
+		SetAckpolicy(qc, pattrib->ack_policy);
+	}
+	/* TODO: fill HT Control Field */
+	/* Update Seq Num will be handled by f/w */
+	{
+		struct sta_info *psta;
+		bool bmcst = is_multicast_ether_addr(pattrib->ra);
+
+		if (pattrib->psta)
+			psta = pattrib->psta;
+		else if (bmcst)
+			psta = r8712_get_bcmc_stainfo(padapter);
+		else
+			psta = r8712_get_stainfo(&padapter->stapriv,
+						 pattrib->ra);
+
+		if (psta) {
+			u16 *txtid = psta->sta_xmitpriv.txseq_tid;
+
+			txtid[pattrib->priority]++;
+			txtid[pattrib->priority] &= 0xFFF;
+			pattrib->seqnum = txtid[pattrib->priority];
+			SetSeqNum(hdr, pattrib->seqnum);
 		}
 	}
+
 	return 0;
 }
 
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.h b/drivers/staging/rtl8712/rtl871x_xmit.h
index f227828..c0c0c7 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.h
+++ b/drivers/staging/rtl8712/rtl871x_xmit.h
@@ -115,7 +115,7 @@ struct pkt_attrib {
 	u8	icv_len;
 	unsigned char iv[8];
 	unsigned char icv[8];
-	u8	dst[ETH_ALEN];
+	u8	dst[ETH_ALEN] __aligned(2);	/* for ether_addr_copy */
 	u8	src[ETH_ALEN];
 	u8	ta[ETH_ALEN];
 	u8	ra[ETH_ALEN];


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning
  2020-03-28 19:17       ` Joe Perches
@ 2020-03-28 19:30         ` Aiman Najjar
  2020-04-02  8:16         ` Dan Carpenter
  1 sibling, 0 replies; 14+ messages in thread
From: Aiman Najjar @ 2020-03-28 19:30 UTC (permalink / raw)
  To: Joe Perches
  Cc: devel, Greg Kroah-Hartman, Florian Schilhabel, linux-kernel,
	Larry Finger

On Sat, Mar 28, 2020 at 12:17:19PM -0700, Joe Perches wrote:
> On Fri, 2020-03-27 at 20:08 -0400, aimannajjar wrote:
> > This patch fixes the following checkpatch warning in
> > rtl8712x_xmit.c:
> > 
> > WARNING: Avoid multiple line dereference - prefer 'psta->sta_xmitpriv.txseq_tid[pattrib->priority]'
> > 544: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:544:
> > +				pattrib->seqnum = psta->sta_xmitpriv.
> > +						 txseq_tid[pattrib->priority];
> 
> It's always better to try to make the code clearer than
> merely shut up checkpatch bleats.
> 
> > diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
> []
> > @@ -479,70 +479,70 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
> >  	__le16 *fctrl = &pwlanhdr->frame_ctl;
> >  
> >  	memset(hdr, 0, WLANHDR_OFFSET);
> > -	SetFrameSubType(fctrl, pattrib->subtype);
> > -	if (pattrib->subtype & WIFI_DATA_TYPE) {
> > +	SetFrameSubType(fctrl, pattr->subtype);
> > +	if (pattr->subtype & WIFI_DATA_TYPE) {
> > 
> 
> The whole following block could be outdented one level
> by changing this test to
> 
> 	if (!(pattr->subtype & WIFI_DATA_TYPE))
> 		return 0;
> 
> >  		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
> >  			/* to_ds = 1, fr_ds = 0; */
> >  			SetToDs(fctrl);
> >  			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
> >  				ETH_ALEN);
> The repetitive call to get_bssid(pmlmepriv) could be saved
> by performing it outside this test
> 
> 	u8 bssid = get_bssid(pmlmepriv);
> 
> and then using bssid in each memcpy/ether_addr_copy
> 
> > -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> > -			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
> > +			memcpy(pwlanhdr->addr2, pattr->src, ETH_ALEN);
> > +			memcpy(pwlanhdr->addr3, pattr->dst, ETH_ALEN);
> 
> All of these memcpy could probably use ether_addr_copy if
> 
> 	struct pkt_attrib {
> 		...
> 		u8      dst[ETH_ALEN];
> 		...
> 	};
> 
> was changed to 
> 
> 		u8	dst[ETH_ALEN] __aligned(2);
> 		
> 
> so these would be
> 
> 			ether_addr_copy(pwlanhdr->addr2, pattr->src);
> 
> and pwlanhdr isn't a particularly valuable name
> for an automatic either.  It's hungarian like.
> 
> So I would suggest something like the below that
> avoids any long lines instead and also removes
> unnecessary multi-line statements without renaming.
> 
> ---
>  drivers/staging/rtl8712/rtl871x_xmit.c | 123 ++++++++++++++++-----------------
>  drivers/staging/rtl8712/rtl871x_xmit.h |   2 +-
>  2 files changed, 61 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
> index f0b853..3961dae 100644
> --- a/drivers/staging/rtl8712/rtl871x_xmit.c
> +++ b/drivers/staging/rtl8712/rtl871x_xmit.c
> @@ -477,75 +477,72 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
>  	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>  	struct qos_priv *pqospriv = &pmlmepriv->qospriv;
>  	__le16 *fctrl = &pwlanhdr->frame_ctl;
> +	u8 *bssid;
>  
>  	memset(hdr, 0, WLANHDR_OFFSET);
>  	SetFrameSubType(fctrl, pattrib->subtype);
> -	if (pattrib->subtype & WIFI_DATA_TYPE) {
> -		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
> -			/* to_ds = 1, fr_ds = 0; */
> -			SetToDs(fctrl);
> -			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
> -				ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
> -		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
> -			/* to_ds = 0, fr_ds = 1; */
> -			SetFrDs(fctrl);
> -			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv),
> -				ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
> -		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
> -			   check_fwstate(pmlmepriv,
> -					 WIFI_ADHOC_MASTER_STATE)) {
> -			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
> -				ETH_ALEN);
> -		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> -			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
> -			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> -			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
> -				ETH_ALEN);
> -		} else {
> -			return -EINVAL;
> -		}
> +	if (!(pattrib->subtype & WIFI_DATA_TYPE))
> +		return 0;
>  
> -		if (pattrib->encrypt)
> -			SetPrivacy(fctrl);
> -		if (pqospriv->qos_option) {
> -			qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
> -			if (pattrib->priority)
> -				SetPriority(qc, pattrib->priority);
> -			SetAckpolicy(qc, pattrib->ack_policy);
> -		}
> -		/* TODO: fill HT Control Field */
> -		/* Update Seq Num will be handled by f/w */
> -		{
> -			struct sta_info *psta;
> -			bool bmcst = is_multicast_ether_addr(pattrib->ra);
> -
> -			if (pattrib->psta) {
> -				psta = pattrib->psta;
> -			} else {
> -				if (bmcst)
> -					psta = r8712_get_bcmc_stainfo(padapter);
> -				else
> -					psta =
> -					 r8712_get_stainfo(&padapter->stapriv,
> -					 pattrib->ra);
> -			}
> -			if (psta) {
> -				psta->sta_xmitpriv.txseq_tid
> -						  [pattrib->priority]++;
> -				psta->sta_xmitpriv.txseq_tid[pattrib->priority]
> -						   &= 0xFFF;
> -				pattrib->seqnum = psta->sta_xmitpriv.
> -						  txseq_tid[pattrib->priority];
> -				SetSeqNum(hdr, pattrib->seqnum);
> -			}
> +	bssid = get_bssid(pmlmepriv);
> +
> +	if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
> +		/* to_ds = 1, fr_ds = 0; */
> +		SetToDs(fctrl);
> +		ether_addr_copy(pwlanhdr->addr1, bssid);
> +		ether_addr_copy(pwlanhdr->addr2, pattrib->src);
> +		ether_addr_copy(pwlanhdr->addr3, pattrib->dst);
> +	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
> +		/* to_ds = 0, fr_ds = 1; */
> +		SetFrDs(fctrl);
> +		ether_addr_copy(pwlanhdr->addr1, pattrib->dst);
> +		ether_addr_copy(pwlanhdr->addr2, bssid);
> +		ether_addr_copy(pwlanhdr->addr3, pattrib->src);
> +	} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
> +		   check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
> +		ether_addr_copy(pwlanhdr->addr1, pattrib->dst);
> +		ether_addr_copy(pwlanhdr->addr2, pattrib->src);
> +		ether_addr_copy(pwlanhdr->addr3, bssid);
> +	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> +		ether_addr_copy(pwlanhdr->addr1, pattrib->dst);
> +		ether_addr_copy(pwlanhdr->addr2, pattrib->src);
> +		ether_addr_copy(pwlanhdr->addr3, bssid);
> +	} else {
> +		return -EINVAL;
> +	}
> +
> +	if (pattrib->encrypt)
> +		SetPrivacy(fctrl);
> +	if (pqospriv->qos_option) {
> +		qc = (unsigned short *)(hdr + pattrib->hdrlen - 2);
> +		if (pattrib->priority)
> +			SetPriority(qc, pattrib->priority);
> +		SetAckpolicy(qc, pattrib->ack_policy);
> +	}
> +	/* TODO: fill HT Control Field */
> +	/* Update Seq Num will be handled by f/w */
> +	{
> +		struct sta_info *psta;
> +		bool bmcst = is_multicast_ether_addr(pattrib->ra);
> +
> +		if (pattrib->psta)
> +			psta = pattrib->psta;
> +		else if (bmcst)
> +			psta = r8712_get_bcmc_stainfo(padapter);
> +		else
> +			psta = r8712_get_stainfo(&padapter->stapriv,
> +						 pattrib->ra);
> +
> +		if (psta) {
> +			u16 *txtid = psta->sta_xmitpriv.txseq_tid;
> +
> +			txtid[pattrib->priority]++;
> +			txtid[pattrib->priority] &= 0xFFF;
> +			pattrib->seqnum = txtid[pattrib->priority];
> +			SetSeqNum(hdr, pattrib->seqnum);
>  		}
>  	}
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.h b/drivers/staging/rtl8712/rtl871x_xmit.h
> index f227828..c0c0c7 100644
> --- a/drivers/staging/rtl8712/rtl871x_xmit.h
> +++ b/drivers/staging/rtl8712/rtl871x_xmit.h
> @@ -115,7 +115,7 @@ struct pkt_attrib {
>  	u8	icv_len;
>  	unsigned char iv[8];
>  	unsigned char icv[8];
> -	u8	dst[ETH_ALEN];
> +	u8	dst[ETH_ALEN] __aligned(2);	/* for ether_addr_copy */
>  	u8	src[ETH_ALEN];
>  	u8	ta[ETH_ALEN];
>  	u8	ra[ETH_ALEN];
> 
> 

Thanks very much for your review and suggestions, Joe! That
all makes sense to me, I will submit a revised patchset.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: rtl8712: fix checkpatch warnings
  2020-03-26  5:56 [PATCH] staging: rtl8712: fix checkpatch warnings Aiman Najjar
  2020-03-27  8:04 ` Greg Kroah-Hartman
@ 2020-04-02  8:12 ` Dan Carpenter
  1 sibling, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2020-04-02  8:12 UTC (permalink / raw)
  To: Aiman Najjar
  Cc: devel, Florian Schilhabel, Greg Kroah-Hartman, linux-kernel,
	Larry Finger

On Thu, Mar 26, 2020 at 01:56:16AM -0400, Aiman Najjar wrote:
> @@ -350,7 +351,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
>  	struct	sta_info *stainfo;
>  	struct	qos_priv *pqospriv = &(padapter->mlmepriv.qospriv);
>  	struct	pkt_attrib  *pattrib = &pxmitframe->attrib;
> -	struct	security_priv *psecuritypriv = &padapter->securitypriv;
> +	struct	security_priv *psecpriv = &padapter->securitypriv;

This patch is doing too many things of course, but the other problem is
that when you're renaming variables we don't what them to start with "p"
to mean that they are a pointer.  "psecpriv" should just be "secpriv".
That name is still kind of rubbish, but it's not against the rules like
starting with a p for pointer.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning
  2020-03-28 19:17       ` Joe Perches
  2020-03-28 19:30         ` Aiman Najjar
@ 2020-04-02  8:16         ` Dan Carpenter
  1 sibling, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2020-04-02  8:16 UTC (permalink / raw)
  To: Joe Perches
  Cc: devel, Florian Schilhabel, Greg Kroah-Hartman, linux-kernel,
	aimannajjar, Larry Finger

Hi Aiman,

On Sat, Mar 28, 2020 at 12:17:19PM -0700, Joe Perches wrote:
> On Fri, 2020-03-27 at 20:08 -0400, aimannajjar wrote:
> 
> so these would be
> 
> 			ether_addr_copy(pwlanhdr->addr2, pattr->src);
> 
> and pwlanhdr isn't a particularly valuable name
> for an automatic either.  It's hungarian like.
>

"Hungarian like" means it starts with a "p".

https://en.wikipedia.org/wiki/Hungarian_notation

It's against the rules of kernel style.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning
  2020-03-28  0:08     ` [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning aimannajjar
@ 2020-04-02  8:17       ` Dan Carpenter
  2020-04-02  8:19       ` Dan Carpenter
  1 sibling, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2020-04-02  8:17 UTC (permalink / raw)
  To: aimannajjar
  Cc: devel, Greg Kroah-Hartman, Larry Finger, linux-kernel,
	Florian Schilhabel

On Fri, Mar 27, 2020 at 08:08:07PM -0400, aimannajjar wrote:
> This patch fixes these two long-line checkpatch warnings
> in rtl871x_xmit.c:
> 
> WARNING: line over 80 characters
> \#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74:
> +       * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
> 
> WARNING: line over 80 characters
> \#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79:
> +               kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);
> 
> Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
                 ^^^^^^^^^^^

You need to use your proper legal name here.  Please capitalize normally
like you would on a legal document.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning
  2020-03-28  0:08     ` [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning aimannajjar
  2020-04-02  8:17       ` Dan Carpenter
@ 2020-04-02  8:19       ` Dan Carpenter
  1 sibling, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2020-04-02  8:19 UTC (permalink / raw)
  To: aimannajjar
  Cc: devel, Greg Kroah-Hartman, Larry Finger, linux-kernel,
	Florian Schilhabel

On Fri, Mar 27, 2020 at 08:08:07PM -0400, aimannajjar wrote:
> This patch fixes these two long-line checkpatch warnings
> in rtl871x_xmit.c:
> 
> WARNING: line over 80 characters
> \#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74:
> +       * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
> 
> WARNING: line over 80 characters
> \#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79:
> +               kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC);
> 
> Signed-off-by: aimannajjar <aiman.najjar@hurranet.com>
> ---
>  drivers/staging/rtl8712/rtl871x_xmit.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
> index f0b85338b567..628e4bad1547 100644
> --- a/drivers/staging/rtl8712/rtl871x_xmit.c
> +++ b/drivers/staging/rtl8712/rtl871x_xmit.c
> @@ -71,12 +71,13 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
>  	_init_queue(&pxmitpriv->apsd_queue);
>  	_init_queue(&pxmitpriv->free_xmit_queue);
>  	/*
> -	 * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME,
> +	 * Please allocate memory with sz = (struct xmit_frame) * NR_XMITFRAME,
>  	 * and initialize free_xmit_frame below.
>  	 * Please also apply  free_txobj to link_up all the xmit_frames...

Probably you could delete the "Please ".

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2020-04-02  8:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  5:56 [PATCH] staging: rtl8712: fix checkpatch warnings Aiman Najjar
2020-03-27  8:04 ` Greg Kroah-Hartman
2020-03-28  0:08   ` [PATCH v2 0/5] staging: rtl8712: fix rtl871x_xmit.c warnings aimannajjar
2020-03-28  0:08     ` [PATCH v2 1/5] staging: rtl8712: fix checkpatch long-line warning aimannajjar
2020-04-02  8:17       ` Dan Carpenter
2020-04-02  8:19       ` Dan Carpenter
2020-03-28  0:08     ` [PATCH v2 2/5] staging: rtl8712: fix long-line checkpatch warning aimannajjar
2020-03-28  0:08     ` [PATCH v2 3/5] staging: rtl8712: fix checkpatch warnings aimannajjar
2020-03-28  0:08     ` [PATCH v2 4/5] staging: rtl8712: fix multiline derefernce warning aimannajjar
2020-03-28 19:17       ` Joe Perches
2020-03-28 19:30         ` Aiman Najjar
2020-04-02  8:16         ` Dan Carpenter
2020-03-28  0:08     ` [PATCH v2 5/5] staging: rtl8712:fix multiline derefernce warnings aimannajjar
2020-04-02  8:12 ` [PATCH] staging: rtl8712: fix checkpatch warnings Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).