Commit a1436579 authored by Chaehyun Lim's avatar Chaehyun Lim Committed by Greg Kroah-Hartman

staging: wilc1000: linux_mon: fix NULL comparison style

This patch fixes NULL comparsion style found by checkpatch.pl

CHECK: Comparison to NULL could be written "!wilc_wfi_mon"
CHECK: Comparison to NULL could be written "!skb"
CHECK: Comparison to NULL could be written "!skb"
CHECK: Comparison to NULL could be written "!dev"
CHECK: Comparison to NULL could be written "!mgmt_tx"
CHECK: Comparison to NULL could be written "!mgmt_tx->buff"
CHECK: Comparison to NULL could be written "!wilc_wfi_mon"
CHECK: Comparison to NULL could be written "!mon_priv"
CHECK: Comparison to NULL could be written "!priv"
CHECK: Comparison to NULL could be written "wilc_wfi_mon"
Signed-off-by: default avatarChaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24e33bd5
...@@ -54,7 +54,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) ...@@ -54,7 +54,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)
PRINT_INFO(HOSTAPD_DBG, "In monitor interface receive function\n"); PRINT_INFO(HOSTAPD_DBG, "In monitor interface receive function\n");
if (wilc_wfi_mon == NULL) if (!wilc_wfi_mon)
return; return;
if (!netif_running(wilc_wfi_mon)) { if (!netif_running(wilc_wfi_mon)) {
...@@ -73,7 +73,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) ...@@ -73,7 +73,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)
/* hostapd callback mgmt frame */ /* hostapd callback mgmt frame */
skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_cb_hdr)); skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_cb_hdr));
if (skb == NULL) { if (!skb) {
PRINT_INFO(HOSTAPD_DBG, "Monitor if : No memory to allocate skb"); PRINT_INFO(HOSTAPD_DBG, "Monitor if : No memory to allocate skb");
return; return;
} }
...@@ -103,7 +103,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) ...@@ -103,7 +103,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)
} else { } else {
skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_hdr)); skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_hdr));
if (skb == NULL) { if (!skb) {
PRINT_INFO(HOSTAPD_DBG, "Monitor if : No memory to allocate skb"); PRINT_INFO(HOSTAPD_DBG, "Monitor if : No memory to allocate skb");
return; return;
} }
...@@ -156,20 +156,20 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) ...@@ -156,20 +156,20 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
{ {
struct tx_complete_mon_data *mgmt_tx = NULL; struct tx_complete_mon_data *mgmt_tx = NULL;
if (dev == NULL) { if (!dev) {
PRINT_D(HOSTAPD_DBG, "ERROR: dev == NULL\n"); PRINT_D(HOSTAPD_DBG, "ERROR: dev == NULL\n");
return -EFAULT; return -EFAULT;
} }
netif_stop_queue(dev); netif_stop_queue(dev);
mgmt_tx = kmalloc(sizeof(struct tx_complete_mon_data), GFP_ATOMIC); mgmt_tx = kmalloc(sizeof(struct tx_complete_mon_data), GFP_ATOMIC);
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(len, GFP_ATOMIC); mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
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;
...@@ -203,12 +203,12 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, ...@@ -203,12 +203,12 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
struct sk_buff *skb2; struct sk_buff *skb2;
struct wilc_wfi_radiotap_cb_hdr *cb_hdr; struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
if (wilc_wfi_mon == NULL) if (!wilc_wfi_mon)
return -EFAULT; return -EFAULT;
mon_priv = netdev_priv(wilc_wfi_mon); mon_priv = netdev_priv(wilc_wfi_mon);
if (mon_priv == NULL) { if (!mon_priv) {
PRINT_ER("Monitor interface private structure is NULL\n"); PRINT_ER("Monitor interface private structure is NULL\n");
return -EFAULT; return -EFAULT;
} }
...@@ -324,7 +324,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi ...@@ -324,7 +324,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi
return NULL; return NULL;
} }
priv = netdev_priv(wilc_wfi_mon); priv = netdev_priv(wilc_wfi_mon);
if (priv == NULL) { if (!priv) {
PRINT_ER("private structure is NULL\n"); PRINT_ER("private structure is NULL\n");
return NULL; return NULL;
} }
...@@ -347,7 +347,7 @@ int WILC_WFI_deinit_mon_interface(void) ...@@ -347,7 +347,7 @@ int WILC_WFI_deinit_mon_interface(void)
{ {
bool rollback_lock = false; bool rollback_lock = false;
if (wilc_wfi_mon != NULL) { if (wilc_wfi_mon) {
PRINT_D(HOSTAPD_DBG, "In Deinit monitor interface\n"); PRINT_D(HOSTAPD_DBG, "In Deinit monitor interface\n");
PRINT_D(HOSTAPD_DBG, "RTNL is being locked\n"); PRINT_D(HOSTAPD_DBG, "RTNL is being locked\n");
if (rtnl_is_locked()) { if (rtnl_is_locked()) {
......
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