Skip to contentSkip to conversation

Staging: wilc1000: Use NULL instead of zero

PATCH Superseded Ronit Halder 2 participants 4 messages Sep 14, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wilc1000: Use NULL instead of zero

This patch fixes the warning generated by sparse "Using plain integer as NULL pointer" by using NULL instead of zero.

---
 drivers/staging/wilc1000/coreconfigurator.c | 14 +++++++-------
 drivers/staging/wilc1000/linux_wlan.c       |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +7 -7
index 544c12d..8164a33 100644
@@ -525,7 +525,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 			u16index += (IE_HDR_LEN + pu8msa[u16index + 1]);
 	}
 
-	return 0;
+	return NULL;
 }
 
 /* This function gets the current channel information from
@@ -587,7 +587,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 	u16 u16WidID = (u16)WID_NIL;
 	u16 u16WidLen  = 0;
-	u8  *pu8WidVal = 0;
+	u8  *pu8WidVal = NULL;
 
 	u8MsgType = pu8MsgBuffer[0];
 
@@ -614,10 +614,10 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 	/* parse the WID value of the WID "WID_NEWORK_INFO" */
 	{
-		u8  *pu8msa = 0;
+		u8  *pu8msa = NULL;
 		u16 u16RxLen = 0;
-		u8 *pu8TimElm = 0;
-		u8 *pu8IEs = 0;
+		u8 *pu8TimElm = NULL;
+		u8 *pu8IEs = NULL;
 		u16 u16IEsLen = 0;
 		u8 u8index = 0;
 		u32 u32Tsf_Lo;
@@ -670,7 +670,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 		/* Get DTIM Period */
 		pu8TimElm = get_tim_elm(pu8msa, (u16RxLen + FCS_LEN), u8index);
-		if (pu8TimElm != 0)
+		if (pu8TimElm != NULL)
 			pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
 		pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
 		u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN);
@@ -743,7 +743,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
 	s32 s32Error = WILC_SUCCESS;
 	tstrConnectRespInfo *pstrConnectRespInfo = NULL;
 	u16 u16AssocRespLen = 0;
-	u8 *pu8IEs = 0;
+	u8 *pu8IEs = NULL;
 	u16 u16IEsLen = 0;
 
 	pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
drivers/staging/wilc1000/linux_wlan.c +3 -3
index 63f44f8..d8f17c6 100644
@@ -412,7 +412,7 @@ static int isr_bh_routine(void *vp)
 			break;
 		}
 		PRINT_D(INT_DBG, "Interrupt received BH\n");
-		if (g_linux_wlan->oup.wlan_handle_rx_isr != 0)
+		if (g_linux_wlan->oup.wlan_handle_rx_isr != NULL)
 			g_linux_wlan->oup.wlan_handle_rx_isr();
 		else
 			PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n");
@@ -1284,7 +1284,7 @@ int wlan_initialize_threads(perInterface_wlan_t *nic)
 #elif (RX_BH_TYPE == RX_BH_KTHREAD)
 	PRINT_D(INIT_DBG, "Creating kthread for Rxq BH\n");
 	g_linux_wlan->rx_bh_thread = kthread_run(isr_bh_routine, (void *)g_linux_wlan, "K_RXQ_BH");
-	if (g_linux_wlan->rx_bh_thread == 0) {
+	if (g_linux_wlan->rx_bh_thread == NULL) {
 		PRINT_ER("couldn't create RX BH thread\n");
 		ret = -ENOBUFS;
 		goto _fail_;
@@ -1309,7 +1309,7 @@ int wlan_initialize_threads(perInterface_wlan_t *nic)
 	/* create tx task */
 	PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
 	g_linux_wlan->txq_thread = kthread_run(linux_wlan_txq_task, (void *)g_linux_wlan, "K_TXQ_TASK");
-	if (g_linux_wlan->txq_thread == 0) {
+	if (g_linux_wlan->txq_thread == NULL) {
 		PRINT_ER("couldn't create TXQ thread\n");
 		ret = -ENOBUFS;
 		goto _fail_2;
Signature · 1 line
2.4.0.GIT
#1 lore raw
Quoted 6 lines · Ronit Halder

This patch fixes the warning generated by sparse "Using plain integer as NULL pointer" by using NULL instead of zero.

---

This fixes sparse warning but introduces new checkpatch warnings about NULL comparison.

regards
sudip

#2 lore raw

I checked but it didn't show me any warning.
Can you please specify the warning?

regards

Quoted 12 lines · Sudip Mukherjee
Quoted 6 lines · Ronit Halder

This patch fixes the warning generated by sparse "Using plain integer as NULL pointer" by using NULL instead of zero.

---

This fixes sparse warning but introduces new checkpatch warnings about NULL comparison.

regards
sudip

#3 lore raw
Quoted 2 lines · Ronit Halder

I checked but it didn't show me any warning.
Can you please specify the warning?

try with --strict option of checkpatch.

regards
sudip