]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: wilc1000: remove a macro WILC_NULLCHECK
authorLeo Kim <leo.kim@atmel.com>
Wed, 16 Sep 2015 09:35:59 +0000 (18:35 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2015 04:38:17 +0000 (21:38 -0700)
This patch replaces WILC_NULLCHECK with the plain statements and then removes
the macro WILC_NULLCHECK in wilc_errorsupport.h which is not used anymore.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Tony Cho <tony.cho@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c
drivers/staging/wilc1000/wilc_errorsupport.h
drivers/staging/wilc1000/wilc_msgqueue.c
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c

index 563063ce6ba0a6a9c558a708f5111a475bf764d6..827758d71df041394ad9a80450cab117bacba56a 100644 (file)
@@ -7289,7 +7289,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 -ENOMEM;
 
                memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
                pstrAddStationMsg->pu8Rates = rates;
@@ -7444,7 +7445,9 @@ 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 -ENOMEM;
+
                memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
                pstrAddStationMsg->pu8Rates = rates;
        }
index 8eb8150d5213786e23c7eea54645e42204416ee8..42495d9e19d2dad454697438087534489de3e4cd 100644 (file)
                goto ERRORHANDLER; \
 } while (0)
 
-#define  WILC_NULLCHECK(__status__, __ptr__)   do { \
-               if (__ptr__ == NULL) { \
-                       WILC_ERRORREPORT(__status__, WILC_NULL_PTR); \
-               } \
-} while (0)
-
 #define WILC_CATCH(__status__) \
 ERRORHANDLER: \
        if (__status__ < WILC_SUCCESS) \
index 41244ce942ba26021b223cc66c77d1a09bd3fa5e..ac237365e3e9e789173f04db13494b3ae3dff714 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "wilc_msgqueue.h"
 #include <linux/spinlock.h>
+#include <linux/errno.h>
 
 /*!
  *  @author            syounan
@@ -69,11 +70,15 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
 
        /* construct a new message */
        pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);
-       WILC_NULLCHECK(s32RetStatus, pstrMessage);
+       if (!pstrMessage)
+               return -ENOMEM;
        pstrMessage->u32Length = u32SendBufferSize;
        pstrMessage->pstrNext = NULL;
        pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
-       WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer);
+       if (!pstrMessage->pvBuffer) {
+               s32RetStatus = -ENOMEM;
+               goto ERRORHANDLER;
+       }
        memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
 
        /* add it to the message queue */
index 4151aae0eb9798af856e80a880bebf57b9f2955d..32fd54312659e2b978828f235b01a9f7e7a5bd81 100644 (file)
@@ -15,7 +15,7 @@
 #ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"    /* tony : for set_wiphy_dev() */
 #endif
-
+#include <linux/errno.h>
 
 #define IS_MANAGMEMENT                         0x100
 #define IS_MANAGMEMENT_CALLBACK                        0x080
@@ -381,7 +381,10 @@ 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
@@ -395,7 +398,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),
@@ -3217,8 +3221,8 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
        struct wilc_priv *priv;
        u8 NullBssid[ETH_ALEN] = {0};
 
-
-       WILC_NULLCHECK(s32Error, wiphy);
+       if (!wiphy)
+               return -EFAULT;
 
        priv = wiphy_priv(wiphy);
 
@@ -3254,8 +3258,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 -EFAULT;
 
        priv = wiphy_priv(wiphy);
        nic = netdev_priv(dev);
@@ -3325,7 +3329,8 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
        struct wilc_priv *priv;
        perInterface_wlan_t *nic;
 
-       WILC_NULLCHECK(s32Error, wiphy);
+       if (!wiphy)
+               return -EFAULT;
 
        priv = wiphy_priv(wiphy);
        nic = netdev_priv(dev);
@@ -3371,7 +3376,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 -EFAULT;
 
        priv = wiphy_priv(wiphy);
        nic = netdev_priv(dev);