Commit a4b17197 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 b7d1e18c
......@@ -137,7 +137,7 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
spin_lock_irqsave(&wilc->txq_spinlock, flags);
if (p->txq_head == NULL) {
if (!p->txq_head) {
tqe->next = NULL;
tqe->prev = NULL;
p->txq_head = tqe;
......@@ -168,7 +168,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
if (p->txq_head == NULL) {
if (!p->txq_head) {
tqe->next = NULL;
tqe->prev = NULL;
p->txq_head = tqe;
......@@ -407,7 +407,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
}
tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL) {
if (!tqe) {
PRINT_ER("Failed to allocate memory\n");
return 0;
}
......@@ -438,7 +438,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC);
if (tqe == NULL)
if (!tqe)
return 0;
tqe->type = WILC_NET_PKT;
tqe->buffer = buffer;
......@@ -467,7 +467,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
tqe = kmalloc(sizeof(struct txq_entry_t), GFP_KERNEL);
if (tqe == NULL)
if (!tqe)
return 0;
tqe->type = WILC_MGMT_PKT;
tqe->buffer = buffer;
......@@ -518,7 +518,7 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe)
return 0;
mutex_lock(&wilc->rxq_cs);
if (p->rxq_head == NULL) {
if (!p->rxq_head) {
PRINT_D(RX_DBG, "Add to Queue head\n");
rqe->next = NULL;
p->rxq_head = rqe;
......@@ -723,7 +723,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
i = 0;
sum = 0;
do {
if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1))) {
if (tqe && (i < (WILC_VMM_TBL_SIZE - 1))) {
if (tqe->type == WILC_CFG_PKT)
vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET;
......@@ -871,7 +871,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount)
i = 0;
do {
tqe = wilc_wlan_txq_remove_from_head(dev);
if (tqe != NULL && (vmm_table[i] != 0)) {
if (tqe && (vmm_table[i] != 0)) {
u32 header, buffer_offset;
#ifdef BIG_ENDIAN
......@@ -962,7 +962,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
break;
}
rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL) {
if (!rqe) {
PRINT_D(RX_DBG, "nothing in the queue - exit 1st do-while\n");
break;
}
......@@ -1110,7 +1110,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
#else
buffer = kmalloc(size, GFP_KERNEL);
if (buffer == NULL) {
if (!buffer) {
wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size);
usleep_range(100 * 1000, 100 * 1000);
goto _end_;
......@@ -1130,7 +1130,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
p->rx_buffer_offset = offset;
#endif
rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL);
if (rqe != NULL) {
if (rqe) {
rqe->buffer = buffer;
rqe->buffer_size = size;
PRINT_D(RX_DBG, "rxq entery Size= %d - Address = %p\n", rqe->buffer_size, rqe->buffer);
......@@ -1184,7 +1184,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size)
blksz = BIT(12);
dma_buffer = kmalloc(blksz, GFP_KERNEL);
if (dma_buffer == NULL) {
if (!dma_buffer) {
ret = -5;
PRINT_ER("Can't allocate buffer for firmware download IO error\n ");
goto _fail_1;
......@@ -1406,7 +1406,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
p->quit = 1;
do {
tqe = wilc_wlan_txq_remove_from_head(dev);
if (tqe == NULL)
if (!tqe)
break;
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv, 0);
......@@ -1415,7 +1415,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
do {
rqe = wilc_wlan_rxq_remove(wilc);
if (rqe == NULL)
if (!rqe)
break;
#ifndef MEMORY_STATIC
kfree(rqe->buffer);
......@@ -1670,21 +1670,21 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
goto _fail_;
}
if (g_wlan.tx_buffer == NULL)
if (!g_wlan.tx_buffer)
g_wlan.tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL);
PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
if (g_wlan.tx_buffer == NULL) {
if (!g_wlan.tx_buffer) {
ret = -105;
PRINT_ER("Can't allocate Tx Buffer");
goto _fail_;
}
#if defined (MEMORY_STATIC)
if (g_wlan.rx_buffer == NULL)
if (!g_wlan.rx_buffer)
g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL);
PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
if (g_wlan.rx_buffer == NULL) {
if (!g_wlan.rx_buffer) {
ret = -105;
PRINT_ER("Can't allocate Rx Buffer");
goto _fail_;
......
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