Commit 369a1d3b authored by Leo Kim's avatar Leo Kim Committed by Greg Kroah-Hartman

staging: wilc1000: replace explicit NULL comparisons with !

This patch replace explicit NULL comparison with ! operator to simplify code.
Reported by checkpatch.pl for Comparison to NULL could be written !XXX" or "XXX".
Signed-off-by: default avatarLeo Kim <leo.kim@atmel.com>
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3bac1c51
...@@ -463,7 +463,7 @@ static void CfgScanResult(enum scan_event scan_event, ...@@ -463,7 +463,7 @@ static void CfgScanResult(enum scan_event scan_event,
down(&(priv->hSemScanReq)); down(&(priv->hSemScanReq));
if (priv->pstrScanReq != NULL) { if (priv->pstrScanReq) {
cfg80211_scan_done(priv->pstrScanReq, false); cfg80211_scan_done(priv->pstrScanReq, false);
priv->u32RcvdChCount = 0; priv->u32RcvdChCount = 0;
priv->bCfgScanning = false; priv->bCfgScanning = false;
...@@ -474,7 +474,7 @@ static void CfgScanResult(enum scan_event scan_event, ...@@ -474,7 +474,7 @@ static void CfgScanResult(enum scan_event scan_event,
down(&(priv->hSemScanReq)); down(&(priv->hSemScanReq));
PRINT_D(CFG80211_DBG, "Scan Aborted\n"); PRINT_D(CFG80211_DBG, "Scan Aborted\n");
if (priv->pstrScanReq != NULL) { if (priv->pstrScanReq) {
update_scan_time(); update_scan_time();
refresh_scan(priv, 1, false); refresh_scan(priv, 1, false);
...@@ -645,7 +645,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) ...@@ -645,7 +645,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
for (i = 0; i < request->n_ssids; i++) { for (i = 0; i < request->n_ssids; i++) {
if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) { if (request->ssids[i].ssid &&
request->ssids[i].ssid_len != 0) {
strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL); strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL);
memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len);
strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len; strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len;
...@@ -716,7 +717,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -716,7 +717,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
sme->ssid, sme->ssid,
sme->ssid_len) == 0) { sme->ssid_len) == 0) {
PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid);
if (sme->bssid == NULL) { if (!sme->bssid) {
PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n"); PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n");
break; break;
} else { } else {
...@@ -1009,12 +1010,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -1009,12 +1010,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_TKIP: case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) { if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
if (priv->wilc_gtk[key_index] == NULL) { if (!priv->wilc_gtk[key_index]) {
priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL); priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_gtk[key_index]->key = NULL; priv->wilc_gtk[key_index]->key = NULL;
priv->wilc_gtk[key_index]->seq = NULL; priv->wilc_gtk[key_index]->seq = NULL;
} }
if (priv->wilc_ptk[key_index] == NULL) { if (!priv->wilc_ptk[key_index]) {
priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL); priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL);
priv->wilc_ptk[key_index]->key = NULL; priv->wilc_ptk[key_index]->key = NULL;
priv->wilc_ptk[key_index]->seq = NULL; priv->wilc_ptk[key_index]->seq = NULL;
...@@ -1828,12 +1829,12 @@ static int mgmt_tx(struct wiphy *wiphy, ...@@ -1828,12 +1829,12 @@ static int mgmt_tx(struct wiphy *wiphy,
if (ieee80211_is_mgmt(mgmt->frame_control)) { if (ieee80211_is_mgmt(mgmt->frame_control)) {
mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL); mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
if (mgmt_tx == NULL) { if (!mgmt_tx) {
PRINT_ER("Failed to allocate memory for mgmt_tx structure\n"); PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
return -EFAULT; return -EFAULT;
} }
mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL); mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL);
if (mgmt_tx->buff == NULL) { if (!mgmt_tx->buff) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
kfree(mgmt_tx); kfree(mgmt_tx);
return -EFAULT; return -EFAULT;
...@@ -2037,11 +2038,11 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, ...@@ -2037,11 +2038,11 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout); PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout);
if (wiphy == NULL) if (!wiphy)
return -ENOENT; return -ENOENT;
priv = wiphy_priv(wiphy); priv = wiphy_priv(wiphy);
if (priv->hWILCWFIDrv == NULL) { if (!priv->hWILCWFIDrv) {
PRINT_ER("Driver is NULL\n"); PRINT_ER("Driver is NULL\n");
return -EIO; return -EIO;
} }
...@@ -2451,7 +2452,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -2451,7 +2452,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n",
strStaParams.rates_len); strStaParams.rates_len);
if (params->ht_capa == NULL) { if (!params->ht_capa) {
strStaParams.ht_supported = false; strStaParams.ht_supported = false;
} else { } else {
strStaParams.ht_supported = true; strStaParams.ht_supported = true;
...@@ -2511,7 +2512,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -2511,7 +2512,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Deleting station\n"); PRINT_D(HOSTAPD_DBG, "Deleting station\n");
if (mac == NULL) { if (!mac) {
PRINT_D(HOSTAPD_DBG, "All associated stations\n"); PRINT_D(HOSTAPD_DBG, "All associated stations\n");
s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
} else { } else {
...@@ -2557,7 +2558,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -2557,7 +2558,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev,
PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n",
strStaParams.rates_len); strStaParams.rates_len);
if (params->ht_capa == NULL) { if (!params->ht_capa) {
strStaParams.ht_supported = false; strStaParams.ht_supported = false;
} else { } else {
strStaParams.ht_supported = true; strStaParams.ht_supported = true;
...@@ -2622,7 +2623,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, ...@@ -2622,7 +2623,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n"); PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n");
PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", nic->wilc_netdev); PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", nic->wilc_netdev);
new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev); new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev);
if (new_ifc != NULL) { if (new_ifc) {
PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n");
nic = netdev_priv(priv->wdev->netdev); nic = netdev_priv(priv->wdev->netdev);
nic->monitor_flag = 1; nic->monitor_flag = 1;
...@@ -2748,7 +2749,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de ...@@ -2748,7 +2749,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
PRINT_D(CFG80211_DBG, "Registering wifi device\n"); PRINT_D(CFG80211_DBG, "Registering wifi device\n");
wdev = WILC_WFI_CfgAlloc(); wdev = WILC_WFI_CfgAlloc();
if (wdev == NULL) { if (!wdev) {
PRINT_ER("CfgAlloc Failed\n"); PRINT_ER("CfgAlloc Failed\n");
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment