diff mbox

[OPW,kernel] staging:vt6655: Fix sparse warnings of using plain integer as NULL pointer

Message ID 20140317092310.GA5228@himangi-Inspiron-N5110gmail.com
State New, archived
Headers show

Commit Message

HIMANGI SARAOGI March 17, 2014, 9:23 a.m. UTC
This patch fixes the following sparse warnings:
drivers/staging/vt6655/wmgr.c:970:42: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:971:41: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:972:38: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:973:43: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:4110:37: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:4111:41: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:4112:34: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:4113:30: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:4114:35: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:4123:32: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:1815:41: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:1816:34: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:1817:30: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:1818:35: warning: Using plain integer as NULL pointer
drivers/staging/vt6655/wmgr.c:2075:63: warning: Using plain integer as NULL pointer

The following coccinelle script was used to achieve this:
@rule1@
expression *x;
@@
(
- x = 0;
+ x = NULL;
|
- (x == 0)
+ (x == NULL)
|
- (x != 0)
+ (x != NULL)
)

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
 drivers/staging/vt6655/wmgr.c |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

Comments

Paul E. McKenney March 17, 2014, 6:45 p.m. UTC | #1
On Mon, Mar 17, 2014 at 02:53:10PM +0530, Himangi Saraogi wrote:
> This patch fixes the following sparse warnings:
> drivers/staging/vt6655/wmgr.c:970:42: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:971:41: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:972:38: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:973:43: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:4110:37: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:4111:41: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:4112:34: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:4113:30: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:4114:35: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:4123:32: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:1815:41: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:1816:34: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:1817:30: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:1818:35: warning: Using plain integer as NULL pointer
> drivers/staging/vt6655/wmgr.c:2075:63: warning: Using plain integer as NULL pointer
> 
> The following coccinelle script was used to achieve this:
> @rule1@
> expression *x;
> @@
> (
> - x = 0;
> + x = NULL;
> |
> - (x == 0)
> + (x == NULL)
> |
> - (x != 0)
> + (x != NULL)
> )
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> ---
>  drivers/staging/vt6655/wmgr.c |   30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
> index 5200a2a..b673bc9 100644
> --- a/drivers/staging/vt6655/wmgr.c
> +++ b/drivers/staging/vt6655/wmgr.c
> @@ -967,10 +967,10 @@ s_vMgrRxAssocResponse(
>  		sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
>  		// decode the frame
>  		vMgrDecodeAssocResponse(&sFrame);
> -		if ((sFrame.pwCapInfo == 0) ||
> -		    (sFrame.pwStatus == 0) ||
> -		    (sFrame.pwAid == 0) ||
> -		    (sFrame.pSuppRates == 0)) {
> +		if ((sFrame.pwCapInfo == NULL) ||
> +		    (sFrame.pwStatus == NULL) ||
> +		    (sFrame.pwAid == NULL) ||
> +		    (sFrame.pSuppRates == NULL)) {
>  			DBG_PORT80(0xCC);
>  			return;
>  		}
> @@ -1812,10 +1812,10 @@ s_vMgrRxBeacon(
>  	// decode the beacon frame
>  	vMgrDecodeBeacon(&sFrame);
> 
> -	if ((sFrame.pwBeaconInterval == 0) ||
> -	    (sFrame.pwCapInfo == 0) ||
> -	    (sFrame.pSSID == 0) ||
> -	    (sFrame.pSuppRates == 0)) {
> +	if ((sFrame.pwBeaconInterval == NULL) ||
> +	    (sFrame.pwCapInfo == NULL) ||
> +	    (sFrame.pSSID == NULL) ||
> +	    (sFrame.pSuppRates == NULL)) {
>  		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n");
>  		return;
>  	}
> @@ -2072,7 +2072,7 @@ s_vMgrRxBeacon(
>  		if (bTSFLargeDiff)
>  			bUpdateTSF = true;
> 
> -		if (pDevice->bEnablePSMode && (sFrame.pTIM != 0)) {
> +		if (pDevice->bEnablePSMode && (sFrame.pTIM != NULL)) {
>  			// deal with DTIM, analysis TIM
>  			pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false;
>  			pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount;
> @@ -4107,11 +4107,11 @@ s_vMgrRxProbeResponse(
>  	sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
>  	vMgrDecodeProbeResponse(&sFrame);
> 
> -	if ((sFrame.pqwTimestamp == 0) ||
> -	    (sFrame.pwBeaconInterval == 0) ||
> -	    (sFrame.pwCapInfo == 0) ||
> -	    (sFrame.pSSID == 0) ||
> -	    (sFrame.pSuppRates == 0)) {
> +	if ((sFrame.pqwTimestamp == NULL) ||
> +	    (sFrame.pwBeaconInterval == NULL) ||
> +	    (sFrame.pwCapInfo == NULL) ||
> +	    (sFrame.pSSID == NULL) ||
> +	    (sFrame.pSuppRates == NULL)) {
>  		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header);
>  		DBG_PORT80(0xCC);
>  		return;
> @@ -4120,7 +4120,7 @@ s_vMgrRxProbeResponse(
>  	if (sFrame.pSSID->len == 0)
>  		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n");
> 
> -	if (sFrame.pDSParms != 0) {
> +	if (sFrame.pDSParms != NULL) {
>  		if (byCurrChannel > CB_MAX_CHANNEL_24G) {
>  			// channel remapping to
>  			byIEChannel = get_channel_mapping(pMgmt->pAdapter, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
diff mbox

Patch

diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index 5200a2a..b673bc9 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -967,10 +967,10 @@  s_vMgrRxAssocResponse(
 		sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
 		// decode the frame
 		vMgrDecodeAssocResponse(&sFrame);
-		if ((sFrame.pwCapInfo == 0) ||
-		    (sFrame.pwStatus == 0) ||
-		    (sFrame.pwAid == 0) ||
-		    (sFrame.pSuppRates == 0)) {
+		if ((sFrame.pwCapInfo == NULL) ||
+		    (sFrame.pwStatus == NULL) ||
+		    (sFrame.pwAid == NULL) ||
+		    (sFrame.pSuppRates == NULL)) {
 			DBG_PORT80(0xCC);
 			return;
 		}
@@ -1812,10 +1812,10 @@  s_vMgrRxBeacon(
 	// decode the beacon frame
 	vMgrDecodeBeacon(&sFrame);
 
-	if ((sFrame.pwBeaconInterval == 0) ||
-	    (sFrame.pwCapInfo == 0) ||
-	    (sFrame.pSSID == 0) ||
-	    (sFrame.pSuppRates == 0)) {
+	if ((sFrame.pwBeaconInterval == NULL) ||
+	    (sFrame.pwCapInfo == NULL) ||
+	    (sFrame.pSSID == NULL) ||
+	    (sFrame.pSuppRates == NULL)) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n");
 		return;
 	}
@@ -2072,7 +2072,7 @@  s_vMgrRxBeacon(
 		if (bTSFLargeDiff)
 			bUpdateTSF = true;
 
-		if (pDevice->bEnablePSMode && (sFrame.pTIM != 0)) {
+		if (pDevice->bEnablePSMode && (sFrame.pTIM != NULL)) {
 			// deal with DTIM, analysis TIM
 			pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false;
 			pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount;
@@ -4107,11 +4107,11 @@  s_vMgrRxProbeResponse(
 	sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
 	vMgrDecodeProbeResponse(&sFrame);
 
-	if ((sFrame.pqwTimestamp == 0) ||
-	    (sFrame.pwBeaconInterval == 0) ||
-	    (sFrame.pwCapInfo == 0) ||
-	    (sFrame.pSSID == 0) ||
-	    (sFrame.pSuppRates == 0)) {
+	if ((sFrame.pqwTimestamp == NULL) ||
+	    (sFrame.pwBeaconInterval == NULL) ||
+	    (sFrame.pwCapInfo == NULL) ||
+	    (sFrame.pSSID == NULL) ||
+	    (sFrame.pSuppRates == NULL)) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header);
 		DBG_PORT80(0xCC);
 		return;
@@ -4120,7 +4120,7 @@  s_vMgrRxProbeResponse(
 	if (sFrame.pSSID->len == 0)
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n");
 
-	if (sFrame.pDSParms != 0) {
+	if (sFrame.pDSParms != NULL) {
 		if (byCurrChannel > CB_MAX_CHANNEL_24G) {
 			// channel remapping to
 			byIEChannel = get_channel_mapping(pMgmt->pAdapter, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);