From c7e65f4d2f7968de8605ef1b83ac1019e8e51d22 Mon Sep 17 00:00:00 2001 From: sayli karnik Date: Tue, 13 Sep 2016 02:47:28 +0530 Subject: staging: ks7010: Remove the explicit NULL comparison The patch removes the explicit null comparisons entirely for the ks7010 driver. This was detected by checkpatch.pl Signed-off-by: sayli karnik Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 632253c..d5299f0 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -266,7 +266,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, if (priv->dev_state < DEVICE_STATE_BOOT) { kfree(p); - if (complete_handler != NULL) + if (complete_handler) (*complete_handler) (arg1, arg2); return 1; } @@ -275,7 +275,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, /* in case of buffer overflow */ DPRINTK(1, "tx buffer overflow\n"); kfree(p); - if (complete_handler != NULL) + if (complete_handler) (*complete_handler) (arg1, arg2); return 1; } @@ -346,7 +346,7 @@ static void tx_device_task(void *dev) } kfree(sp->sendp); /* allocated memory free */ - if (sp->complete_handler != NULL) /* TX Complete */ + if (sp->complete_handler) /* TX Complete */ (*sp->complete_handler) (sp->arg1, sp->arg2); inc_txqhead(priv); @@ -687,7 +687,7 @@ static void trx_device_exit(struct ks_wlan_private *priv) while (cnt_txqbody(priv) > 0) { sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; kfree(sp->sendp); /* allocated memory free */ - if (sp->complete_handler != NULL) /* TX Complete */ + if (sp->complete_handler) /* TX Complete */ (*sp->complete_handler) (sp->arg1, sp->arg2); inc_txqhead(priv); } @@ -1010,7 +1010,7 @@ static int ks7010_sdio_probe(struct sdio_func *func, /* private memory allocate */ netdev = alloc_etherdev(sizeof(*priv)); - if (netdev == NULL) { + if (!netdev) { printk(KERN_ERR "ks7010 : Unable to alloc new net device\n"); goto error_release_irq; } @@ -1126,7 +1126,7 @@ static void ks7010_sdio_remove(struct sdio_func *func) card = sdio_get_drvdata(func); - if (card == NULL) + if (!card) return; DPRINTK(1, "priv = card->priv\n"); @@ -1149,7 +1149,7 @@ static void ks7010_sdio_remove(struct sdio_func *func) struct hostif_stop_request_t *pp; pp = (struct hostif_stop_request_t *) kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; /* to do goto ni suru */ } diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index e09df360..8e33a43 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1178,7 +1178,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *packet) kmalloc(hif_align_size(sizeof(*pp) + 6 + packet_len + 8), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); dev_kfree_skb(packet); return -2; @@ -1319,7 +1319,7 @@ void hostif_mib_get_request(struct ks_wlan_private *priv, /* make primitive */ pp = (struct hostif_mib_get_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1350,7 +1350,7 @@ void hostif_mib_set_request(struct ks_wlan_private *priv, /* make primitive */ pp = (struct hostif_mib_set_request_t *) kmalloc(hif_align_size(sizeof(*pp) + size), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1380,7 +1380,7 @@ void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode) /* make primitive */ pp = (struct hostif_start_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1408,7 +1408,7 @@ void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_ps_adhoc_set_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1452,7 +1452,7 @@ void hostif_infrastructure_set_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_infrastructure_set_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1519,7 +1519,7 @@ static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_infrastructure_set2_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1589,7 +1589,7 @@ void hostif_adhoc_set_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_adhoc_set_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1635,7 +1635,7 @@ void hostif_adhoc_set2_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_adhoc_set2_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1683,7 +1683,7 @@ void hostif_stop_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_stop_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1706,7 +1706,7 @@ void hostif_phy_information_request(struct ks_wlan_private *priv) /* make primitive */ pp = (struct hostif_phy_information_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1738,7 +1738,7 @@ void hostif_power_mngmt_request(struct ks_wlan_private *priv, /* make primitive */ pp = (struct hostif_power_mngmt_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1765,7 +1765,7 @@ void hostif_sleep_request(struct ks_wlan_private *priv, unsigned long mode) /* make primitive */ pp = (struct hostif_sleep_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1799,7 +1799,7 @@ void hostif_bss_scan_request(struct ks_wlan_private *priv, /* make primitive */ pp = (struct hostif_bss_scan_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } @@ -1856,7 +1856,7 @@ void hostif_mic_failure_request(struct ks_wlan_private *priv, /* make primitive */ pp = (struct hostif_mic_failure_request_t *) kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); - if (pp == NULL) { + if (!pp) { DPRINTK(3, "allocate memory failed..\n"); return; } diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index d69b4c9..a35325e 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -3366,7 +3366,7 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) DPRINTK(3, "in_interrupt()=%ld\n", in_interrupt()); - if (skb == NULL) { + if (!skb) { printk(KERN_ERR "ks_wlan: skb == NULL!!!\n"); return 0; } -- cgit v0.10.2