Skip to contentSkip to conversation

staging: wilc1000: replace s32Error with result

PATCH In review Chaehyun Lim 3 participants 6 messages Sep 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging: wilc1000: replace s32Error with result

Most of functions use s32Error variable to check error and return its value. This patch replaces s32Error with result to avoid CamelCase.

---
 drivers/staging/wilc1000/coreconfigurator.c       |  40 +-
 drivers/staging/wilc1000/host_interface.c         | 900 +++++++++++-----------
 drivers/staging/wilc1000/linux_wlan.c             |  12 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 230 +++---
 4 files changed, 591 insertions(+), 591 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +20 -20
index 14e8efc..ad3b546 100644
@@ -339,11 +339,11 @@ static inline u16 get_asoc_id(u8 *data)
 
 s32 CoreConfiguratorInit(void)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 
 	PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
 
-	return s32Error;
+	return result;
 }
 
 u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
@@ -414,7 +414,7 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  */
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 	tstrNetworkInfo *pstrNetworkInfo = NULL;
 	u8 u8MsgType = 0;
 	u8 u8MsgID = 0;
@@ -523,7 +523,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
 	*ppstrNetworkInfo = pstrNetworkInfo;
 
-	return s32Error;
+	return result;
 }
 
 /**
@@ -538,24 +538,24 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
  */
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 
 	if (pstrNetworkInfo != NULL) {
 		if (pstrNetworkInfo->pu8IEs != NULL) {
 			kfree(pstrNetworkInfo->pu8IEs);
 			pstrNetworkInfo->pu8IEs = NULL;
 		} else {
-			s32Error = -EFAULT;
+			result = -EFAULT;
 		}
 
 		kfree(pstrNetworkInfo);
 		pstrNetworkInfo = NULL;
 
 	} else {
-		s32Error = -EFAULT;
+		result = -EFAULT;
 	}
 
-	return s32Error;
+	return result;
 }
 
 /**
@@ -572,7 +572,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
 			       tstrConnectRespInfo **ppstrConnectRespInfo)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 	tstrConnectRespInfo *pstrConnectRespInfo = NULL;
 	u16 u16AssocRespLen = 0;
 	u8 *pu8IEs = NULL;
@@ -614,7 +614,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
 	*ppstrConnectRespInfo = pstrConnectRespInfo;
 
 
-	return s32Error;
+	return result;
 }
 
 /**
@@ -629,24 +629,24 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
  */
 s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 
 	if (pstrConnectRespInfo != NULL) {
 		if (pstrConnectRespInfo->pu8RespIEs != NULL) {
 			kfree(pstrConnectRespInfo->pu8RespIEs);
 			pstrConnectRespInfo->pu8RespIEs = NULL;
 		} else {
-			s32Error = -EFAULT;
+			result = -EFAULT;
 		}
 
 		kfree(pstrConnectRespInfo);
 		pstrConnectRespInfo = NULL;
 
 	} else {
-		s32Error = -EFAULT;
+		result = -EFAULT;
 	}
 
-	return s32Error;
+	return result;
 }
 
 #ifndef CONNECT_DIRECT
@@ -654,7 +654,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
 			       wid_site_survey_reslts_s **ppstrSurveyResults,
 			       u32 *pu32SurveyResultsCount)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 	wid_site_survey_reslts_s *pstrSurveyResults = NULL;
 	u32 u32SurveyResultsCount = 0;
 	u32 u32SurveyBytesLength = 0;
@@ -703,19 +703,19 @@ ERRORHANDLER:
 	*ppstrSurveyResults = pstrSurveyResults;
 	*pu32SurveyResultsCount = u32SurveyResultsCount;
 
-	return s32Error;
+	return result;
 }
 
 
 s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 
 	if (pstrSurveyResults != NULL) {
 		kfree(pstrSurveyResults);
 	}
 
-	return s32Error;
+	return result;
 }
 #endif
 
@@ -731,12 +731,12 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 
 s32 CoreConfiguratorDeInit(void)
 {
-	s32 s32Error = 0;
+	s32 result = 0;
 
 	PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
 
 
-	return s32Error;
+	return result;
 }
 
 /*Using the global handle of the driver*/
drivers/staging/wilc1000/host_interface.c +450 -450

2,829 lines not on this page · raw message

drivers/staging/wilc1000/linux_wlan.c +6 -6
index 7857ad2..8ecc5aa 100644
@@ -1688,7 +1688,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 	u32 size = 0, length = 0;
 	perInterface_wlan_t *nic;
 	struct wilc_priv *priv;
-	s32 s32Error = 0;
+	s32 result = 0;
 
 	/* struct iwreq *wrq = (struct iwreq *) req;	// tony moved to case SIOCSIWPRIV */
 	nic = netdev_priv(ndev);
@@ -1713,8 +1713,8 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 
 			if (strncasecmp(buff, "RSSI", length) == 0) {
 				priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
-				s32Error = host_int_get_rssi(priv->hWILCWFIDrv, &(rssi));
-				if (s32Error)
+				result = host_int_get_rssi(priv->hWILCWFIDrv, &(rssi));
+				if (result)
 					PRINT_ER("Failed to send get rssi param's message queue ");
 				PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
 
@@ -1725,7 +1725,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 
 				if (copy_to_user(wrq->u.data.pointer, buff, size)) {
 					PRINT_ER("%s: failed to copy data to user buffer\n", __func__);
-					s32Error = -EFAULT;
+					result = -EFAULT;
 					goto done;
 				}
 			}

Lines of this file are not shown. View the raw message.

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +115 -115

230 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.1

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 2/2 staging: wilc1000: rename SendConfigPkt

This patch replaces SendConfigPkt with send_config_pkt to avoid CamelCase.

---
 drivers/staging/wilc1000/coreconfigurator.c |   4 +-
 drivers/staging/wilc1000/coreconfigurator.h |   4 +-
 drivers/staging/wilc1000/host_interface.c   | 102 ++++++++++++++--------------
 3 files changed, 55 insertions(+), 55 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +2 -2
index ad3b546..04e72b9 100644
@@ -756,8 +756,8 @@ extern wilc_wlan_oup_t *gpstrWlanOps;
  *  @date		1 Mar 2012
  *  @version	1.0
  */
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
-			  u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
+s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
+		    u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
 {
 	s32 counter = 0, ret = 0;
 
drivers/staging/wilc1000/coreconfigurator.h +2 -2
index 8439066..a7904e2 100644
@@ -159,8 +159,8 @@ typedef struct wid_site_survey_reslts {
 s32 CoreConfiguratorInit(void);
 s32 CoreConfiguratorDeInit(void);
 
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
-		  u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
+s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
+		    u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
 
drivers/staging/wilc1000/host_interface.c +51 -51

408 lines not on this page · raw message

Signature · 1 line
2.5.1
#2 lore raw
In reply to Chaehyun Lim

Hi Chaehyun,

Quoted 16 lines · Chaehyun Lim

Most of functions use s32Error variable to check error and return its value. This patch replaces s32Error with result to avoid CamelCase.

---
 drivers/staging/wilc1000/coreconfigurator.c       |  40 +-
 drivers/staging/wilc1000/host_interface.c         | 900 +++++++++++-----------
 drivers/staging/wilc1000/linux_wlan.c             |  12 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 230 +++---
 4 files changed, 591 insertions(+), 591 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -0
index 14e8efc..ad3b546 100644

drivers/staging/wilc1000/coreconfigurator.c static inline u16 get_asoc_id(u8 *data) · line 346

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
@@ -339,11 +339,11 @@ static inline u16 get_asoc_id(u8 *data)
 
 s32 CoreConfiguratorInit(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
 
-       return s32Error;
+       return result;

This variable is never changed from 0 in this function, so why not just get rid of it? (Perhaps in a separate patch?)

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -414,7 +414,7 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  */
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        tstrNetworkInfo *pstrNetworkInfo = NULL;
        u8 u8MsgType = 0;
        u8 u8MsgID = 0;

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 526

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -523,7 +523,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
        *ppstrNetworkInfo = pstrNetworkInfo;
 
-       return s32Error;
+       return result;

Same here.

Quoted 4 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
@@ -538,24 +538,24 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
  */
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 {

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 548

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrNetworkInfo != NULL) {
                if (pstrNetworkInfo->pu8IEs != NULL) {
                        kfree(pstrNetworkInfo->pu8IEs);
                        pstrNetworkInfo->pu8IEs = NULL;
                } else {
-                       s32Error = -EFAULT;
+                       result = -EFAULT;

Stupid question: why is it an error if it's already deallocated?

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 555

Quoted 8 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
                }
 
                kfree(pstrNetworkInfo);
                pstrNetworkInfo = NULL;
 
        } else {
-               s32Error = -EFAULT;
+               result = -EFAULT;

And again.

Quoted 17 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
        }
 
-       return s32Error;
+       return result;
 }
 
 /**
@@ -572,7 +572,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
                               tstrConnectRespInfo **ppstrConnectRespInfo)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        tstrConnectRespInfo *pstrConnectRespInfo = NULL;
        u16 u16AssocRespLen = 0;
        u8 *pu8IEs = NULL;

drivers/staging/wilc1000/coreconfigurator.c s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, · line 617

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -614,7 +614,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
        *ppstrConnectRespInfo = pstrConnectRespInfo;
 
 
-       return s32Error;
+       return result;

Another useless variable.

Quoted 7 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 /**
@@ -629,24 +629,24 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
  */
 s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
 {

drivers/staging/wilc1000/coreconfigurator.c s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, · line 639

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrConnectRespInfo != NULL) {
                if (pstrConnectRespInfo->pu8RespIEs != NULL) {
                        kfree(pstrConnectRespInfo->pu8RespIEs);
                        pstrConnectRespInfo->pu8RespIEs = NULL;
                } else {
-                       s32Error = -EFAULT;
+                       result = -EFAULT;

and again, why return an error if it's already deallocated?

Quoted 25 lines
drivers/staging/wilc1000/coreconfigurator.c +3 -3
                }
 
                kfree(pstrConnectRespInfo);
                pstrConnectRespInfo = NULL;
 
        } else {
-               s32Error = -EFAULT;
+               result = -EFAULT;
        }
 
-       return s32Error;
+       return result;
 }
 
 #ifndef CONNECT_DIRECT
@@ -654,7 +654,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
                               wid_site_survey_reslts_s **ppstrSurveyResults,
                               u32 *pu32SurveyResultsCount)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        wid_site_survey_reslts_s *pstrSurveyResults = NULL;
        u32 u32SurveyResultsCount = 0;
        u32 u32SurveyBytesLength = 0;

drivers/staging/wilc1000/coreconfigurator.c ERRORHANDLER: · line 706

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -703,19 +703,19 @@ ERRORHANDLER:
        *ppstrSurveyResults = pstrSurveyResults;
        *pu32SurveyResultsCount = u32SurveyResultsCount;
 
-       return s32Error;
+       return result;

Another useless variable.

Quoted 4 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 
 s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)

drivers/staging/wilc1000/coreconfigurator.c ERRORHANDLER: · line 718

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrSurveyResults != NULL) {
                kfree(pstrSurveyResults);
        }
 
-       return s32Error;
+       return result;

Ditto.

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 #endif
 
@@ -731,12 +731,12 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 

drivers/staging/wilc1000/coreconfigurator.c s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults) · line 739

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
 s32 CoreConfiguratorDeInit(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
 
 
-       return s32Error;
+       return result;

Ditto.

Quoted 8 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 /*Using the global handle of the driver*/
drivers/staging/wilc1000/host_interface.c +0 -0
index 0546f7a..f997628 100644

drivers/staging/wilc1000/host_interface.c ERRORHANDLER: · line 1273

Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +2 -2
@@ -1266,11 +1266,11 @@ ERRORHANDLER:
  */
 static s32 Handle_wait_msg_q_empty(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        g_wilc_initialized = 0;
        up(&hWaitResponse);
-       return s32Error;
+       return result;

Another useless variable.

And I'm stopping here.

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
#3 lore raw
Quoted 223 lines · Julian Calaby

Hi Chaehyun,

Quoted 16 lines · Chaehyun Lim

Most of functions use s32Error variable to check error and return its value. This patch replaces s32Error with result to avoid CamelCase.

---
 drivers/staging/wilc1000/coreconfigurator.c       |  40 +-
 drivers/staging/wilc1000/host_interface.c         | 900 +++++++++++-----------
 drivers/staging/wilc1000/linux_wlan.c             |  12 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 230 +++---
 4 files changed, 591 insertions(+), 591 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -0
index 14e8efc..ad3b546 100644

drivers/staging/wilc1000/coreconfigurator.c static inline u16 get_asoc_id(u8 *data) · line 346

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
@@ -339,11 +339,11 @@ static inline u16 get_asoc_id(u8 *data)
 
 s32 CoreConfiguratorInit(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
 
-       return s32Error;
+       return result;

This variable is never changed from 0 in this function, so why not just get rid of it? (Perhaps in a separate patch?)

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -414,7 +414,7 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  */
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        tstrNetworkInfo *pstrNetworkInfo = NULL;
        u8 u8MsgType = 0;
        u8 u8MsgID = 0;

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 526

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -523,7 +523,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
        *ppstrNetworkInfo = pstrNetworkInfo;
 
-       return s32Error;
+       return result;

Same here.

Quoted 4 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
@@ -538,24 +538,24 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
  */
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 {

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 548

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrNetworkInfo != NULL) {
                if (pstrNetworkInfo->pu8IEs != NULL) {
                        kfree(pstrNetworkInfo->pu8IEs);
                        pstrNetworkInfo->pu8IEs = NULL;
                } else {
-                       s32Error = -EFAULT;
+                       result = -EFAULT;

Stupid question: why is it an error if it's already deallocated?

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 555

Quoted 8 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
                }
 
                kfree(pstrNetworkInfo);
                pstrNetworkInfo = NULL;
 
        } else {
-               s32Error = -EFAULT;
+               result = -EFAULT;

And again.

Quoted 17 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
        }
 
-       return s32Error;
+       return result;
 }
 
 /**
@@ -572,7 +572,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
                               tstrConnectRespInfo **ppstrConnectRespInfo)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        tstrConnectRespInfo *pstrConnectRespInfo = NULL;
        u16 u16AssocRespLen = 0;
        u8 *pu8IEs = NULL;

drivers/staging/wilc1000/coreconfigurator.c s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, · line 617

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -614,7 +614,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
        *ppstrConnectRespInfo = pstrConnectRespInfo;
 
 
-       return s32Error;
+       return result;

Another useless variable.

Quoted 7 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 /**
@@ -629,24 +629,24 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
  */
 s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
 {

drivers/staging/wilc1000/coreconfigurator.c s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, · line 639

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrConnectRespInfo != NULL) {
                if (pstrConnectRespInfo->pu8RespIEs != NULL) {
                        kfree(pstrConnectRespInfo->pu8RespIEs);
                        pstrConnectRespInfo->pu8RespIEs = NULL;
                } else {
-                       s32Error = -EFAULT;
+                       result = -EFAULT;

and again, why return an error if it's already deallocated?

Quoted 25 lines
drivers/staging/wilc1000/coreconfigurator.c +3 -3
                }
 
                kfree(pstrConnectRespInfo);
                pstrConnectRespInfo = NULL;
 
        } else {
-               s32Error = -EFAULT;
+               result = -EFAULT;
        }
 
-       return s32Error;
+       return result;
 }
 
 #ifndef CONNECT_DIRECT
@@ -654,7 +654,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
                               wid_site_survey_reslts_s **ppstrSurveyResults,
                               u32 *pu32SurveyResultsCount)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        wid_site_survey_reslts_s *pstrSurveyResults = NULL;
        u32 u32SurveyResultsCount = 0;
        u32 u32SurveyBytesLength = 0;

drivers/staging/wilc1000/coreconfigurator.c ERRORHANDLER: · line 706

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -703,19 +703,19 @@ ERRORHANDLER:
        *ppstrSurveyResults = pstrSurveyResults;
        *pu32SurveyResultsCount = u32SurveyResultsCount;
 
-       return s32Error;
+       return result;

Another useless variable.

Quoted 4 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 
 s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)

drivers/staging/wilc1000/coreconfigurator.c ERRORHANDLER: · line 718

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrSurveyResults != NULL) {
                kfree(pstrSurveyResults);
        }
 
-       return s32Error;
+       return result;

Ditto.

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 #endif
 
@@ -731,12 +731,12 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 

drivers/staging/wilc1000/coreconfigurator.c s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults) · line 739

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
 s32 CoreConfiguratorDeInit(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
 
 
-       return s32Error;
+       return result;

Ditto.

Quoted 8 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 /*Using the global handle of the driver*/
drivers/staging/wilc1000/host_interface.c +0 -0
index 0546f7a..f997628 100644

drivers/staging/wilc1000/host_interface.c ERRORHANDLER: · line 1273

Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +2 -2
@@ -1266,11 +1266,11 @@ ERRORHANDLER:
  */
 static s32 Handle_wait_msg_q_empty(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        g_wilc_initialized = 0;
        up(&hWaitResponse);
-       return s32Error;
+       return result;

Another useless variable.

And I'm stopping here.

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

#4 lore raw
Quoted 217 lines · Chaehyun Lim
Quoted 216 lines · Julian Calaby

Hi Chaehyun,

Quoted 16 lines · Chaehyun Lim

Most of functions use s32Error variable to check error and return its value. This patch replaces s32Error with result to avoid CamelCase.

---
 drivers/staging/wilc1000/coreconfigurator.c       |  40 +-
 drivers/staging/wilc1000/host_interface.c         | 900 +++++++++++-----------
 drivers/staging/wilc1000/linux_wlan.c             |  12 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 230 +++---
 4 files changed, 591 insertions(+), 591 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -0
index 14e8efc..ad3b546 100644

drivers/staging/wilc1000/coreconfigurator.c static inline u16 get_asoc_id(u8 *data) · line 346

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
@@ -339,11 +339,11 @@ static inline u16 get_asoc_id(u8 *data)
 
 s32 CoreConfiguratorInit(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
 
-       return s32Error;
+       return result;

This variable is never changed from 0 in this function, so why not just get rid of it? (Perhaps in a separate patch?)

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -414,7 +414,7 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  */
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        tstrNetworkInfo *pstrNetworkInfo = NULL;
        u8 u8MsgType = 0;
        u8 u8MsgID = 0;

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 526

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -523,7 +523,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 
        *ppstrNetworkInfo = pstrNetworkInfo;
 
-       return s32Error;
+       return result;

Same here.

Quoted 4 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
@@ -538,24 +538,24 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
  */
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 {

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 548

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrNetworkInfo != NULL) {
                if (pstrNetworkInfo->pu8IEs != NULL) {
                        kfree(pstrNetworkInfo->pu8IEs);
                        pstrNetworkInfo->pu8IEs = NULL;
                } else {
-                       s32Error = -EFAULT;
+                       result = -EFAULT;

Stupid question: why is it an error if it's already deallocated?

drivers/staging/wilc1000/coreconfigurator.c s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 555

Quoted 8 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
                }
 
                kfree(pstrNetworkInfo);
                pstrNetworkInfo = NULL;
 
        } else {
-               s32Error = -EFAULT;
+               result = -EFAULT;

And again.

Quoted 17 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
        }
 
-       return s32Error;
+       return result;
 }
 
 /**
@@ -572,7 +572,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
 s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
                               tstrConnectRespInfo **ppstrConnectRespInfo)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        tstrConnectRespInfo *pstrConnectRespInfo = NULL;
        u16 u16AssocRespLen = 0;
        u8 *pu8IEs = NULL;

drivers/staging/wilc1000/coreconfigurator.c s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, · line 617

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -614,7 +614,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
        *ppstrConnectRespInfo = pstrConnectRespInfo;
 
 
-       return s32Error;
+       return result;

Another useless variable.

Quoted 7 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 /**
@@ -629,24 +629,24 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
  */
 s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
 {

drivers/staging/wilc1000/coreconfigurator.c s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, · line 639

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrConnectRespInfo != NULL) {
                if (pstrConnectRespInfo->pu8RespIEs != NULL) {
                        kfree(pstrConnectRespInfo->pu8RespIEs);
                        pstrConnectRespInfo->pu8RespIEs = NULL;
                } else {
-                       s32Error = -EFAULT;
+                       result = -EFAULT;

and again, why return an error if it's already deallocated?

Quoted 25 lines
drivers/staging/wilc1000/coreconfigurator.c +3 -3
                }
 
                kfree(pstrConnectRespInfo);
                pstrConnectRespInfo = NULL;
 
        } else {
-               s32Error = -EFAULT;
+               result = -EFAULT;
        }
 
-       return s32Error;
+       return result;
 }
 
 #ifndef CONNECT_DIRECT
@@ -654,7 +654,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
                               wid_site_survey_reslts_s **ppstrSurveyResults,
                               u32 *pu32SurveyResultsCount)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
        wid_site_survey_reslts_s *pstrSurveyResults = NULL;
        u32 u32SurveyResultsCount = 0;
        u32 u32SurveyBytesLength = 0;

drivers/staging/wilc1000/coreconfigurator.c ERRORHANDLER: · line 706

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +1 -1
@@ -703,19 +703,19 @@ ERRORHANDLER:
        *ppstrSurveyResults = pstrSurveyResults;
        *pu32SurveyResultsCount = u32SurveyResultsCount;
 
-       return s32Error;
+       return result;

Another useless variable.

Quoted 4 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 
 s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)

drivers/staging/wilc1000/coreconfigurator.c ERRORHANDLER: · line 718

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        if (pstrSurveyResults != NULL) {
                kfree(pstrSurveyResults);
        }
 
-       return s32Error;
+       return result;

Ditto.

Quoted 5 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 #endif
 
@@ -731,12 +731,12 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults)
 

drivers/staging/wilc1000/coreconfigurator.c s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults) · line 739

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +2 -2
 s32 CoreConfiguratorDeInit(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
 
 
-       return s32Error;
+       return result;

Ditto.

Quoted 8 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 }
 
 /*Using the global handle of the driver*/
drivers/staging/wilc1000/host_interface.c +0 -0
index 0546f7a..f997628 100644

drivers/staging/wilc1000/host_interface.c ERRORHANDLER: · line 1273

Quoted 10 lines
drivers/staging/wilc1000/host_interface.c +2 -2
@@ -1266,11 +1266,11 @@ ERRORHANDLER:
  */
 static s32 Handle_wait_msg_q_empty(void)
 {
-       s32 s32Error = 0;
+       s32 result = 0;
 
        g_wilc_initialized = 0;
        up(&hWaitResponse);
-       return s32Error;
+       return result;

Another useless variable.

And I'm stopping here.

Quoted 7 lines
Quoted 7 lines

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

I appreciate for your comment. This patch just replaces s32Error variable, not considering usage at each function.
Before making this change, I considered whether it is replaced all at once or changed each function. I decided to change all, then go further other patch.

Regards
Chaehyun Lim

maintainer
#5 lore raw
In reply to Chaehyun Lim
Quoted 4 lines · Chaehyun Lim

Most of functions use s32Error variable to check error and return its value. This patch replaces s32Error with result to avoid CamelCase.

This doesn't apply at all anymore.

I suggest doing as Julian said, fix this up correctly, no need to rename a variable and then delete it in a later patch. Start doing good content cleanups, not just name replacements.

thanks,

greg k-h