]> err.no Git - linux-2.6/commitdiff
NULL noise in drivers/net
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 24 Jan 2008 10:06:46 +0000 (02:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:07:12 +0000 (15:07 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
24 files changed:
drivers/net/3c515.c
drivers/net/7990.c
drivers/net/a2065.c
drivers/net/bnx2.c
drivers/net/cassini.c
drivers/net/eepro100.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/mkiss.c
drivers/net/hp100.c
drivers/net/mac89x0.c
drivers/net/mace.c
drivers/net/netxen/netxen_nic_main.c
drivers/net/skfp/hwmtm.c
drivers/net/skfp/smt.c
drivers/net/sungem.c
drivers/net/sunhme.c
drivers/net/tg3.c
drivers/net/tokenring/smctr.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/lmc/lmc_media.c
drivers/net/wan/pc300_drv.c
drivers/net/wan/pc300_tty.c
drivers/net/wireless/airo.c
drivers/net/xen-netfront.c

index 684bab7810156998f3fd366b27ac1b645d5169e7..6ab84b661d70b34549d954ff9f173e07be06bd41 100644 (file)
@@ -1361,7 +1361,7 @@ static int boomerang_rx(struct net_device *dev)
                        /* Check if the packet is long enough to just accept without
                           copying to a properly sized skbuff. */
                        if (pkt_len < rx_copybreak
-                           && (skb = dev_alloc_skb(pkt_len + 4)) != 0) {
+                           && (skb = dev_alloc_skb(pkt_len + 4)) != NULL) {
                                skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
                                /* 'skb_put()' points to the start of sk_buff data area. */
                                memcpy(skb_put(skb, pkt_len),
index 224e0bff1ae085ab777e1699e80fbd982bd7601a..750a46f4bc582beb5e8ca0762790127c3e0f09fe 100644 (file)
@@ -277,8 +277,6 @@ static int lance_rx (struct net_device *dev)
         volatile struct lance_init_block *ib = lp->init_block;
         volatile struct lance_rx_desc *rd;
         unsigned char bits;
-        int len = 0;                    /* XXX shut up gcc warnings */
-        struct sk_buff *skb = 0;        /* XXX shut up gcc warnings */
 #ifdef TEST_HITS
         int i;
 #endif
@@ -318,10 +316,10 @@ static int lance_rx (struct net_device *dev)
                         if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++;
                         if (bits & LE_R1_EOP) dev->stats.rx_errors++;
                 } else {
-                        len = (rd->mblength & 0xfff) - 4;
-                        skb = dev_alloc_skb (len+2);
+                       int len = (rd->mblength & 0xfff) - 4;
+                       struct sk_buff *skb = dev_alloc_skb (len+2);
 
-                        if (skb == 0) {
+                        if (!skb) {
                                 printk ("%s: Memory squeeze, deferring packet.\n",
                                         dev->name);
                                 dev->stats.rx_dropped++;
index 18f7f815f66e2166cf4d12af0927cc85a7ec6cd3..6c5719ae8ccaac3fdaac37fe06fc0aa630c83c89 100644 (file)
@@ -269,8 +269,6 @@ static int lance_rx (struct net_device *dev)
        volatile struct lance_regs *ll = lp->ll;
        volatile struct lance_rx_desc *rd;
        unsigned char bits;
-       int len = 0;                    /* XXX shut up gcc warnings */
-       struct sk_buff *skb = 0;        /* XXX shut up gcc warnings */
 
 #ifdef TEST_HITS
        int i;
@@ -306,10 +304,10 @@ static int lance_rx (struct net_device *dev)
                        if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++;
                        if (bits & LE_R1_EOP) dev->stats.rx_errors++;
                } else {
-                       len = (rd->mblength & 0xfff) - 4;
-                       skb = dev_alloc_skb (len+2);
+                       int len = (rd->mblength & 0xfff) - 4;
+                       struct sk_buff *skb = dev_alloc_skb (len+2);
 
-                       if (skb == 0) {
+                       if (!skb) {
                                printk(KERN_WARNING "%s: Memory squeeze, "
                                       "deferring packet.\n", dev->name);
                                dev->stats.rx_dropped++;
@@ -477,7 +475,7 @@ static irqreturn_t lance_interrupt (int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-struct net_device *last_dev = 0;
+struct net_device *last_dev;
 
 static int lance_open (struct net_device *dev)
 {
index 94d1857d2c5d06be7735c94300978f8f91c55bc9..3bb69d538ef095cc63fefef948ebd823d6b9fa83 100644 (file)
@@ -2757,7 +2757,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                }
 
 #ifdef BCM_VLAN
-               if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && (bp->vlgrp != 0)) {
+               if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && bp->vlgrp) {
                        vlan_hwaccel_receive_skb(skb, bp->vlgrp,
                                rx_hdr->l2_fhdr_vlan_tag);
                }
@@ -5660,7 +5660,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
                vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
        }
 
-       if (bp->vlgrp != 0 && vlan_tx_tag_present(skb)) {
+       if (bp->vlgrp && vlan_tx_tag_present(skb)) {
                vlan_tag_flags |=
                        (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
        }
index 2bacb5e4604d6018a1221bae0cc8e39834644d5a..14299f8063af16341011a49e7156f2b60688465f 100644 (file)
@@ -5085,7 +5085,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 
        /* give us access to cassini registers */
        cp->regs = pci_iomap(pdev, 0, casreg_len);
-       if (cp->regs == 0UL) {
+       if (!cp->regs) {
                dev_err(&pdev->dev, "Cannot map device registers, aborting.\n");
                goto err_out_free_res;
        }
index 1548a80f917d52650feb344369ab065b16122a4f..3003e92769761721f498bd4f811de4b91f953945 100644 (file)
@@ -1788,7 +1788,7 @@ speedo_rx(struct net_device *dev)
                        /* Check if the packet is long enough to just accept without
                           copying to a properly sized skbuff. */
                        if (pkt_len < rx_copybreak
-                               && (skb = dev_alloc_skb(pkt_len + 2)) != 0) {
+                               && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
                                skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
                                /* 'skb_put()' points to the start of sk_buff data area. */
                                pci_dma_sync_single_for_cpu(sp->pdev, sp->rx_ring_dma[entry],
index 580cb4ab2af10042fccc2d94e5fad7448944cac1..0a9b75139e0f1f82e648df994b79aa9b05a7d20f 100644 (file)
@@ -701,7 +701,7 @@ static void sixpack_close(struct tty_struct *tty)
        sp = tty->disc_data;
        tty->disc_data = NULL;
        write_unlock(&disc_data_lock);
-       if (sp == 0)
+       if (!sp)
                return;
 
        /*
index 803a3bdea0af5f1e36d02055157f55107aff7c87..cfcd15af501e794777c0926ba45539b0dbfe89c1 100644 (file)
@@ -821,7 +821,7 @@ static void mkiss_close(struct tty_struct *tty)
        tty->disc_data = NULL;
        write_unlock(&disc_data_lock);
 
-       if (ax == 0)
+       if (!ax)
                return;
 
        /*
index 49421d1cd3a5d61e1bb4afcd6533478fd8526e31..571dd80fb85009910f6a49d3cda27baa085b54f1 100644 (file)
@@ -1153,7 +1153,7 @@ static void hp100_init_pdls(struct net_device *dev)
        printk("hp100: %s: init pdls\n", dev->name);
 #endif
 
-       if (0 == lp->page_vaddr_algn)
+       if (!lp->page_vaddr_algn)
                printk("hp100: %s: Warning: lp->page_vaddr_algn not initialised!\n", dev->name);
        else {
                /* pageptr shall point into the DMA accessible memory region  */
index a19b5958cee949e89548bbb50acf7768ac44de2f..2a66e5b7cebcbc0217b9bef6aad9b434f9d62242 100644 (file)
@@ -289,7 +289,7 @@ struct net_device * __init mac89x0_probe(int unit)
        err = register_netdev(dev);
        if (err)
                goto out1;
-       return 0;
+       return NULL;
 out1:
        nubus_writew(0, dev->base_addr + ADD_PORT);
 out:
index 95ebe72f320f0ee1cb9ec1c17b8fb661b527f3d1..451acdca2a214a97068b46f597930b25d2e05f87 100644 (file)
@@ -409,7 +409,7 @@ static inline void mace_clean_rings(struct mace_data *mp)
 
     /* free some skb's */
     for (i = 0; i < N_RX_RING; ++i) {
-       if (mp->rx_bufs[i] != 0) {
+       if (mp->rx_bufs[i] != NULL) {
            dev_kfree_skb(mp->rx_bufs[i]);
            mp->rx_bufs[i] = NULL;
        }
@@ -441,7 +441,7 @@ static int mace_open(struct net_device *dev)
     cp = mp->rx_cmds;
     for (i = 0; i < N_RX_RING - 1; ++i) {
        skb = dev_alloc_skb(RX_BUFLEN + 2);
-       if (skb == 0) {
+       if (!skb) {
            data = dummy_buf;
        } else {
            skb_reserve(skb, 2);        /* so IP header lands on 4-byte bdry */
@@ -903,7 +903,7 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
        out_le16(&cp->command, DBDMA_STOP);
        /* got a packet, have a look at it */
        skb = mp->rx_bufs[i];
-       if (skb == 0) {
+       if (!skb) {
            ++dev->stats.rx_dropped;
        } else if (nb > 8) {
            data = skb->data;
@@ -953,9 +953,9 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
            break;
        cp = mp->rx_cmds + i;
        skb = mp->rx_bufs[i];
-       if (skb == 0) {
+       if (!skb) {
            skb = dev_alloc_skb(RX_BUFLEN + 2);
-           if (skb != 0) {
+           if (skb) {
                skb_reserve(skb, 2);
                mp->rx_bufs[i] = skb;
            }
index 97ba14b759b47f19d2e9f5724b3289dbb760022a..2341b89abc4d984f62523e231f36dfc0adb6154f 100644 (file)
@@ -354,8 +354,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto err_out_free_netdev;
        }
 
-       if (((mem_ptr0 == 0UL) && (mem_len == NETXEN_PCI_128MB_SIZE)) ||
-                       (mem_ptr1 == 0UL) || (mem_ptr2 == 0UL)) {
+       if ((!mem_ptr0 && mem_len == NETXEN_PCI_128MB_SIZE) ||
+                       !mem_ptr1 || !mem_ptr2) {
                DPRINTK(ERR,
                        "Cannot remap adapter memory aborting.:"
                        "0 -> %p, 1 -> %p, 2 -> %p\n",
@@ -1337,7 +1337,7 @@ static struct pci_driver netxen_driver = {
 
 static int __init netxen_init_module(void)
 {
-       if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0)
+       if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL)
                return -ENOMEM;
 
        return pci_register_driver(&netxen_driver);
index 438f424e63611ca73f372aa74207713507d34bb5..8a430a36654705fdc5fba5be36b20d3342db5aa4 100644 (file)
@@ -1746,7 +1746,7 @@ static void queue_llc_rx(struct s_smc *smc, SMbuf *mb)
        DB_GEN("queue_llc_rx: mb = %x",(void *)mb,0,4) ;
        smc->os.hwm.queued_rx_frames++ ;
        mb->sm_next = (SMbuf *)NULL ;
-       if (smc->os.hwm.llc_rx_pipe == 0) {
+       if (smc->os.hwm.llc_rx_pipe == NULL) {
                smc->os.hwm.llc_rx_pipe = mb ;
        }
        else {
@@ -1786,7 +1786,7 @@ static void queue_txd_mb(struct s_smc *smc, SMbuf *mb)
        DB_GEN("_rx: queue_txd_mb = %x",(void *)mb,0,4) ;
        smc->os.hwm.queued_txd_mb++ ;
        mb->sm_next = (SMbuf *)NULL ;
-       if (smc->os.hwm.txd_tx_pipe == 0) {
+       if (smc->os.hwm.txd_tx_pipe == NULL) {
                smc->os.hwm.txd_tx_pipe = mb ;
        }
        else {
index ced2c8f76be711f773881d1718405a9367752762..ffbfb1b79f97360975cd8da31d198591fde55037 100644 (file)
@@ -712,7 +712,7 @@ void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs)
                        smc->mib.priv.fddiPRIVECF_Reply_Rx++ ;
                        DB_SMT("SMT: received ECF reply from %s\n",
                                addr_to_string(&sm->smt_source),0) ;
-                       if (sm_to_para(smc,sm,SMT_P_ECHODATA) == 0) {
+                       if (sm_to_para(smc,sm,SMT_P_ECHODATA) == NULL) {
                                DB_SMT("SMT: ECHODATA missing\n",0,0) ;
                                break ;
                        }
index 467d80dc3b335590549978861fc15156a6e99ab7..97212799c513a8f64b5ab6ecef5f366d886a3aa8 100644 (file)
@@ -3056,7 +3056,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
        netif_carrier_off(dev);
 
        gp->regs = ioremap(gemreg_base, gemreg_len);
-       if (gp->regs == 0UL) {
+       if (!gp->regs) {
                printk(KERN_ERR PFX "Cannot map device registers, "
                       "aborting.\n");
                err = -EIO;
index 25ce26a882d18c5b4107a44fb4855e878a58f02c..b4e7f30ea4e8c1d9d186ee91b55c41925136bb9d 100644 (file)
@@ -3060,7 +3060,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
                goto err_out_clear_quattro;
        }
 
-       if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == 0) {
+       if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == NULL) {
                printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n");
                goto err_out_free_res;
        }
index a9f1640884b1b590862113b45e02682f3232d8a8..db606b603884530aa0f433c56a4d080f0e0c6714 100644 (file)
@@ -12675,7 +12675,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
                tg3reg_len = pci_resource_len(pdev, 2);
 
                tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
-               if (tp->aperegs == 0UL) {
+               if (!tp->aperegs) {
                        printk(KERN_ERR PFX "Cannot map APE registers, "
                               "aborting.\n");
                        err = -ENOMEM;
index 93da3a36cde8915922579b2ba26f91a571361388..8909050b8ea7e57cda3efce74c181082bf09d3d9 100644 (file)
@@ -2310,7 +2310,7 @@ static irqreturn_t smctr_interrupt(int irq, void *dev_id)
                                                 && (tp->acb_head->subcmd
                                                 == RW_TRC_STATUS_BLOCK))
                                         {
-                                                if(tp->ptr_bcn_type != 0)
+                                                if(tp->ptr_bcn_type)
                                                 {
                                                         *(tp->ptr_bcn_type)
                                                                 = (__u32)((SBlock *)tp->misc_command_data)->BCN_Type;
@@ -2980,7 +2980,7 @@ static int smctr_load_firmware(struct net_device *dev)
                 return (UCODE_PRESENT);
 
         /* Verify the firmware exists and is there in the right amount. */
-        if((tp->ptr_ucode == 0L)
+        if (!tp->ptr_ucode
                 || (*(tp->ptr_ucode + UCODE_VERSION_OFFSET) < UCODE_VERSION))
         {
                 return (UCODE_NOT_PRESENT);
index 37c52e1317504a5e1a7a0e87ca53a47c7daf697b..6635ecef36e5096702035bfb3af8da662a3caab4 100644 (file)
@@ -491,13 +491,13 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
                     int pos;
                     int timeout = 500000;
 
-                    if(xc.data == 0x0){
+                    if (!xc.data) {
                             ret = -EINVAL;
                             break;
                     }
 
                     data = kmalloc(xc.len, GFP_KERNEL);
-                    if(data == 0x0){
+                    if (!data) {
                             printk(KERN_WARNING "%s: Failed to allocate memory for copy\n", dev->name);
                             ret = -ENOMEM;
                             break;
@@ -1643,7 +1643,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
          * just allocate an skb buff and continue.
          */
         
-        if(skb == 0x0){
+        if (!skb) {
             nsb = dev_alloc_skb (LMC_PKT_BUF_SZ + 2);
             if (nsb) {
                 sc->lmc_rxq[i] = nsb;
index c9c878cd5c72725e6bbc44df92b599afef466b3b..8aa461c941ce903680372cdd25feb12f374c4e72 100644 (file)
@@ -1219,10 +1219,6 @@ lmc_t1_watchdog (lmc_softc_t * const sc)
 static void
 lmc_set_protocol (lmc_softc_t * const sc, lmc_ctl_t * ctl)
 {
-  if (ctl == 0)
-    {
-      sc->ictl.keepalive_onoff = LMC_CTL_ON;
-
-      return;
-    }
+       if (!ctl)
+               sc->ictl.keepalive_onoff = LMC_CTL_ON;
 }
index 99fee2f1d0195d19bf399a35ea58014c34f4c8a5..57914fbd41d370c15df6c2a9531a069a77731166 100644 (file)
@@ -2365,17 +2365,17 @@ static void falc_intr(pc300_t * card)
 
 static irqreturn_t cpc_intr(int irq, void *dev_id)
 {
-       pc300_t *card;
+       pc300_t *card = dev_id;
        volatile ucchar plx_status;
 
-       if ((card = (pc300_t *) dev_id) == 0) {
+       if (!card) {
 #ifdef PC300_DEBUG_INTR
                printk("cpc_intr: spurious intr %d\n", irq);
 #endif
                return IRQ_NONE;                /* spurious intr */
        }
 
-       if (card->hw.rambase == 0) {
+       if (!card->hw.rambase) {
 #ifdef PC300_DEBUG_INTR
                printk("cpc_intr: spurious intr2 %d\n", irq);
 #endif
@@ -3648,7 +3648,7 @@ static void __devexit cpc_remove_one(struct pci_dev *pdev)
 {
        pc300_t *card = pci_get_drvdata(pdev);
 
-       if (card->hw.rambase != 0) {
+       if (card->hw.rambase) {
                int i;
 
                /* Disable interrupts on the PCI bridge */
index e24a7b095dd6921208c3dab48a59d9a327eed0d3..63abfd72542d118c7a8b93f25cbd5ed3098337ca 100644 (file)
@@ -313,7 +313,7 @@ static int cpc_tty_open(struct tty_struct *tty, struct file *flip)
        if (cpc_tty->num_open == 0) { /* first open of this tty */
                if (!cpc_tty_area[port].buf_tx){
                        cpc_tty_area[port].buf_tx = kmalloc(CPC_TTY_MAX_MTU,GFP_KERNEL);
-                       if (cpc_tty_area[port].buf_tx == 0){
+                       if (!cpc_tty_area[port].buf_tx) {
                                CPC_TTY_DBG("%s: error in memory allocation\n",cpc_tty->name);
                                return -ENOMEM;
                        }
@@ -678,7 +678,7 @@ static void cpc_tty_rx_work(struct work_struct *work)
                for (j=0; j < CPC_TTY_NPORTS; j++) {
                        cpc_tty = &cpc_tty_area[port];
                
-                       if ((buf=cpc_tty->buf_rx.first) != 0) {
+                       if ((buf=cpc_tty->buf_rx.first) != NULL) {
                                if (cpc_tty->tty) {
                                        ld = tty_ldisc_ref(cpc_tty->tty);
                                        if (ld) {
@@ -784,7 +784,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev)
                } 
                
                new = kmalloc(rx_len + sizeof(st_cpc_rx_buf), GFP_ATOMIC);
-               if (new == 0) {
+               if (!new) {
                        cpc_tty_rx_disc_frame(pc300chan);
                        continue;
                }
@@ -863,7 +863,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev)
                        } 
                        new->size = rx_len;
                        new->next = NULL;
-                       if (cpc_tty->buf_rx.first == 0) {
+                       if (cpc_tty->buf_rx.first == NULL) {
                                cpc_tty->buf_rx.first = new;
                                cpc_tty->buf_rx.last = new;
                        } else {
@@ -891,7 +891,7 @@ static void cpc_tty_tx_work(struct work_struct *work)
 
        CPC_TTY_DBG("%s: cpc_tty_tx_work init\n",cpc_tty->name);
        
-       if ((tty = cpc_tty->tty) == 0) { 
+       if ((tty = cpc_tty->tty) == NULL) { 
                CPC_TTY_DBG("%s: the interface is not opened\n",cpc_tty->name);
                return; 
        }
@@ -1027,7 +1027,7 @@ void cpc_tty_unregister_service(pc300dev_t *pc300dev)
        ulong flags;
        int res;
 
-       if ((cpc_tty= (st_cpc_tty_area *) pc300dev->cpc_tty) == 0) { 
+       if ((cpc_tty= (st_cpc_tty_area *) pc300dev->cpc_tty) == NULL) {
                CPC_TTY_DBG("%s: interface is not TTY\n", pc300dev->dev->name);
                return; 
        }
index 42670acd144b4502b649160684194fada14aa6e4..be9aa4efeca5ac875072c62facfab1240bc6f562 100644 (file)
@@ -2032,7 +2032,7 @@ static int mpi_send_packet (struct net_device *dev)
 
        /* get a packet to send */
 
-       if ((skb = skb_dequeue(&ai->txq)) == 0) {
+       if ((skb = skb_dequeue(&ai->txq)) == NULL) {
                airo_print_err(dev->name,
                        "%s: Dequeue'd zero in send_packet()",
                        __FUNCTION__);
index bca37bf0f5455812913e448272749b5d55e7c1a6..7483d45bc5bccffefd18b4fa94122eb78d40460f 100644 (file)
@@ -1073,7 +1073,7 @@ static void xennet_release_rx_bufs(struct netfront_info *np)
                if (!xen_feature(XENFEAT_auto_translated_physmap)) {
                        /* Do all the remapping work and M2P updates. */
                        MULTI_mmu_update(mcl, np->rx_mmu, mmu - np->rx_mmu,
-                                        0, DOMID_SELF);
+                                        NULL, DOMID_SELF);
                        mcl++;
                        HYPERVISOR_multicall(np->rx_mcl, mcl - np->rx_mcl);
                }