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

Signed-off-by: Mike Rapoport <mike.rapop...@gmail.com>
---
 drivers/staging/wilc1000/host_interface.c         |  8 +++----
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 26 +++++++++++------------
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index cbd4b12..058e9ad 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -7048,7 +7048,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;
@@ -7059,7 +7060,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;
 }
 
@@ -7194,7 +7194,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;
        }
@@ -7203,7 +7204,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..2677cf6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -375,14 +375,14 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, 
tstrNetworkInfo *pstrNetwo
        struct wiphy *wiphy;
        s32 s32Freq;
        struct ieee80211_channel *channel;
-       s32 s32Error = WILC_SUCCESS;
        struct cfg80211_bss *bss = NULL;
 
        priv = (struct WILC_WFI_priv *)pUserVoid;
        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 +396,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),
@@ -482,11 +483,6 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, 
tstrNetworkInfo *pstrNetwo
                        up(&(priv->hSemScanReq));
                }
        }
-
-
-       WILC_CATCH(s32Error)
-       {
-       }
 }
 
 
@@ -3292,8 +3288,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 +3325,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 +3396,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 +3443,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
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to