[PATCH 05/13] staging: wilc1000: replace WILC_NULLCHECK with return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



WILC_NULLPTR can be replaced with test for NULL pointer and return of
WILC_NULL_PTR.

Signed-off-by: Mike Rapoport <mike.rapoport@xxxxxxxxx>
---
 drivers/staging/wilc1000/host_interface.c         |  8 ++++----
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 20 ++++++++++++--------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index bfade25..7ef5d18 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -7116,7 +7116,8 @@ s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSta
 	if (pstrAddStationMsg->u8NumRates > 0) {
 		u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
 
-		WILC_NULLCHECK(s32Error, rates);
+		if (!rates)
+			return WILC_NULL_PTR;
 
 		memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
 		pstrAddStationMsg->pu8Rates = rates;
@@ -7127,7 +7128,6 @@ s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSta
 	if (s32Error)
 		PRINT_ER("Failed to send add station message\n");
 
-ERRORHANDLER:
 	return s32Error;
 }
 
@@ -7262,7 +7262,8 @@ s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSt
 	if (pstrAddStationMsg->u8NumRates > 0) {
 		u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
 
-		WILC_NULLCHECK(s32Error, rates);
+		if (!rates)
+			return WILC_NULL_PTR;
 		memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
 		pstrAddStationMsg->pu8Rates = rates;
 	}
@@ -7271,7 +7272,6 @@ s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSt
 	if (s32Error)
 		PRINT_ER("Failed to send edit station message\n");
 
-ERRORHANDLER:
 	return s32Error;
 }
 #endif /*WILC_AP_EXTERNAL_MLME*/
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 461cf50..0d5ffaf 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -382,7 +382,8 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 	if (priv->bCfgScanning == true) {
 		if (enuScanEvent == SCAN_EVENT_NETWORK_FOUND) {
 			wiphy = priv->dev->ieee80211_ptr->wiphy;
-			WILC_NULLCHECK(s32Error, wiphy);
+			if (!wiphy)
+				return;
 			if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC
 			    &&
 			    ((((s32)pstrNetworkInfo->s8rssi) * 100) < 0
@@ -396,7 +397,8 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 				s32Freq = ieee80211_channel_to_frequency((s32)pstrNetworkInfo->u8channel, IEEE80211_BAND_2GHZ);
 				channel = ieee80211_get_channel(wiphy, s32Freq);
 
-				WILC_NULLCHECK(s32Error, channel);
+				if (!channel)
+					return;
 
 				PRINT_INFO(CFG80211_DBG, "Network Info:: CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d,"
 					   "BeaconPeriod: %d\n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100),
@@ -3292,8 +3294,8 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	struct WILC_WFI_priv *priv;
 	u8 NullBssid[ETH_ALEN] = {0};
 
-
-	WILC_NULLCHECK(s32Error, wiphy);
+	if (!wiphy)
+		return WILC_NULL_PTR;
 
 	priv = wiphy_priv(wiphy);
 
@@ -3329,8 +3331,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
 	tstrWILC_AddStaParam strStaParams = { {0} };
 	perInterface_wlan_t *nic;
 
-
-	WILC_NULLCHECK(s32Error, wiphy);
+	if (!wiphy)
+		return WILC_NULL_PTR;
 
 	priv = wiphy_priv(wiphy);
 	nic = netdev_priv(dev);
@@ -3400,7 +3402,8 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
 	struct WILC_WFI_priv *priv;
 	perInterface_wlan_t *nic;
 
-	WILC_NULLCHECK(s32Error, wiphy);
+	if (!wiphy)
+		return WILC_NULL_PTR;
 
 	priv = wiphy_priv(wiphy);
 	nic = netdev_priv(dev);
@@ -3446,7 +3449,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
 
 	PRINT_D(HOSTAPD_DBG, "Change station paramters\n");
 
-	WILC_NULLCHECK(s32Error, wiphy);
+	if (!wiphy)
+		return WILC_NULL_PTR;
 
 	priv = wiphy_priv(wiphy);
 	nic = netdev_priv(dev);
-- 
2.1.0

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



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux