Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NULL noise in drivers/net

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>

authored by

Al Viro and committed by
David S. Miller
79ea13ce 3e18826c

+49 -57
+1 -1
drivers/net/3c515.c
··· 1361 1361 /* Check if the packet is long enough to just accept without 1362 1362 copying to a properly sized skbuff. */ 1363 1363 if (pkt_len < rx_copybreak 1364 - && (skb = dev_alloc_skb(pkt_len + 4)) != 0) { 1364 + && (skb = dev_alloc_skb(pkt_len + 4)) != NULL) { 1365 1365 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1366 1366 /* 'skb_put()' points to the start of sk_buff data area. */ 1367 1367 memcpy(skb_put(skb, pkt_len),
+3 -5
drivers/net/7990.c
··· 277 277 volatile struct lance_init_block *ib = lp->init_block; 278 278 volatile struct lance_rx_desc *rd; 279 279 unsigned char bits; 280 - int len = 0; /* XXX shut up gcc warnings */ 281 - struct sk_buff *skb = 0; /* XXX shut up gcc warnings */ 282 280 #ifdef TEST_HITS 283 281 int i; 284 282 #endif ··· 316 318 if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++; 317 319 if (bits & LE_R1_EOP) dev->stats.rx_errors++; 318 320 } else { 319 - len = (rd->mblength & 0xfff) - 4; 320 - skb = dev_alloc_skb (len+2); 321 + int len = (rd->mblength & 0xfff) - 4; 322 + struct sk_buff *skb = dev_alloc_skb (len+2); 321 323 322 - if (skb == 0) { 324 + if (!skb) { 323 325 printk ("%s: Memory squeeze, deferring packet.\n", 324 326 dev->name); 325 327 dev->stats.rx_dropped++;
+4 -6
drivers/net/a2065.c
··· 269 269 volatile struct lance_regs *ll = lp->ll; 270 270 volatile struct lance_rx_desc *rd; 271 271 unsigned char bits; 272 - int len = 0; /* XXX shut up gcc warnings */ 273 - struct sk_buff *skb = 0; /* XXX shut up gcc warnings */ 274 272 275 273 #ifdef TEST_HITS 276 274 int i; ··· 304 306 if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++; 305 307 if (bits & LE_R1_EOP) dev->stats.rx_errors++; 306 308 } else { 307 - len = (rd->mblength & 0xfff) - 4; 308 - skb = dev_alloc_skb (len+2); 309 + int len = (rd->mblength & 0xfff) - 4; 310 + struct sk_buff *skb = dev_alloc_skb (len+2); 309 311 310 - if (skb == 0) { 312 + if (!skb) { 311 313 printk(KERN_WARNING "%s: Memory squeeze, " 312 314 "deferring packet.\n", dev->name); 313 315 dev->stats.rx_dropped++; ··· 475 477 return IRQ_HANDLED; 476 478 } 477 479 478 - struct net_device *last_dev = 0; 480 + struct net_device *last_dev; 479 481 480 482 static int lance_open (struct net_device *dev) 481 483 {
+2 -2
drivers/net/bnx2.c
··· 2757 2757 } 2758 2758 2759 2759 #ifdef BCM_VLAN 2760 - if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && (bp->vlgrp != 0)) { 2760 + if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && bp->vlgrp) { 2761 2761 vlan_hwaccel_receive_skb(skb, bp->vlgrp, 2762 2762 rx_hdr->l2_fhdr_vlan_tag); 2763 2763 } ··· 5660 5660 vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM; 5661 5661 } 5662 5662 5663 - if (bp->vlgrp != 0 && vlan_tx_tag_present(skb)) { 5663 + if (bp->vlgrp && vlan_tx_tag_present(skb)) { 5664 5664 vlan_tag_flags |= 5665 5665 (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); 5666 5666 }
+1 -1
drivers/net/cassini.c
··· 5085 5085 5086 5086 /* give us access to cassini registers */ 5087 5087 cp->regs = pci_iomap(pdev, 0, casreg_len); 5088 - if (cp->regs == 0UL) { 5088 + if (!cp->regs) { 5089 5089 dev_err(&pdev->dev, "Cannot map device registers, aborting.\n"); 5090 5090 goto err_out_free_res; 5091 5091 }
+1 -1
drivers/net/eepro100.c
··· 1788 1788 /* Check if the packet is long enough to just accept without 1789 1789 copying to a properly sized skbuff. */ 1790 1790 if (pkt_len < rx_copybreak 1791 - && (skb = dev_alloc_skb(pkt_len + 2)) != 0) { 1791 + && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { 1792 1792 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 1793 1793 /* 'skb_put()' points to the start of sk_buff data area. */ 1794 1794 pci_dma_sync_single_for_cpu(sp->pdev, sp->rx_ring_dma[entry],
+1 -1
drivers/net/hamradio/6pack.c
··· 701 701 sp = tty->disc_data; 702 702 tty->disc_data = NULL; 703 703 write_unlock(&disc_data_lock); 704 - if (sp == 0) 704 + if (!sp) 705 705 return; 706 706 707 707 /*
+1 -1
drivers/net/hamradio/mkiss.c
··· 821 821 tty->disc_data = NULL; 822 822 write_unlock(&disc_data_lock); 823 823 824 - if (ax == 0) 824 + if (!ax) 825 825 return; 826 826 827 827 /*
+1 -1
drivers/net/hp100.c
··· 1153 1153 printk("hp100: %s: init pdls\n", dev->name); 1154 1154 #endif 1155 1155 1156 - if (0 == lp->page_vaddr_algn) 1156 + if (!lp->page_vaddr_algn) 1157 1157 printk("hp100: %s: Warning: lp->page_vaddr_algn not initialised!\n", dev->name); 1158 1158 else { 1159 1159 /* pageptr shall point into the DMA accessible memory region */
+1 -1
drivers/net/mac89x0.c
··· 289 289 err = register_netdev(dev); 290 290 if (err) 291 291 goto out1; 292 - return 0; 292 + return NULL; 293 293 out1: 294 294 nubus_writew(0, dev->base_addr + ADD_PORT); 295 295 out:
+5 -5
drivers/net/mace.c
··· 409 409 410 410 /* free some skb's */ 411 411 for (i = 0; i < N_RX_RING; ++i) { 412 - if (mp->rx_bufs[i] != 0) { 412 + if (mp->rx_bufs[i] != NULL) { 413 413 dev_kfree_skb(mp->rx_bufs[i]); 414 414 mp->rx_bufs[i] = NULL; 415 415 } ··· 441 441 cp = mp->rx_cmds; 442 442 for (i = 0; i < N_RX_RING - 1; ++i) { 443 443 skb = dev_alloc_skb(RX_BUFLEN + 2); 444 - if (skb == 0) { 444 + if (!skb) { 445 445 data = dummy_buf; 446 446 } else { 447 447 skb_reserve(skb, 2); /* so IP header lands on 4-byte bdry */ ··· 903 903 out_le16(&cp->command, DBDMA_STOP); 904 904 /* got a packet, have a look at it */ 905 905 skb = mp->rx_bufs[i]; 906 - if (skb == 0) { 906 + if (!skb) { 907 907 ++dev->stats.rx_dropped; 908 908 } else if (nb > 8) { 909 909 data = skb->data; ··· 953 953 break; 954 954 cp = mp->rx_cmds + i; 955 955 skb = mp->rx_bufs[i]; 956 - if (skb == 0) { 956 + if (!skb) { 957 957 skb = dev_alloc_skb(RX_BUFLEN + 2); 958 - if (skb != 0) { 958 + if (skb) { 959 959 skb_reserve(skb, 2); 960 960 mp->rx_bufs[i] = skb; 961 961 }
+3 -3
drivers/net/netxen/netxen_nic_main.c
··· 354 354 goto err_out_free_netdev; 355 355 } 356 356 357 - if (((mem_ptr0 == 0UL) && (mem_len == NETXEN_PCI_128MB_SIZE)) || 358 - (mem_ptr1 == 0UL) || (mem_ptr2 == 0UL)) { 357 + if ((!mem_ptr0 && mem_len == NETXEN_PCI_128MB_SIZE) || 358 + !mem_ptr1 || !mem_ptr2) { 359 359 DPRINTK(ERR, 360 360 "Cannot remap adapter memory aborting.:" 361 361 "0 -> %p, 1 -> %p, 2 -> %p\n", ··· 1337 1337 1338 1338 static int __init netxen_init_module(void) 1339 1339 { 1340 - if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0) 1340 + if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL) 1341 1341 return -ENOMEM; 1342 1342 1343 1343 return pci_register_driver(&netxen_driver);
+2 -2
drivers/net/skfp/hwmtm.c
··· 1746 1746 DB_GEN("queue_llc_rx: mb = %x",(void *)mb,0,4) ; 1747 1747 smc->os.hwm.queued_rx_frames++ ; 1748 1748 mb->sm_next = (SMbuf *)NULL ; 1749 - if (smc->os.hwm.llc_rx_pipe == 0) { 1749 + if (smc->os.hwm.llc_rx_pipe == NULL) { 1750 1750 smc->os.hwm.llc_rx_pipe = mb ; 1751 1751 } 1752 1752 else { ··· 1786 1786 DB_GEN("_rx: queue_txd_mb = %x",(void *)mb,0,4) ; 1787 1787 smc->os.hwm.queued_txd_mb++ ; 1788 1788 mb->sm_next = (SMbuf *)NULL ; 1789 - if (smc->os.hwm.txd_tx_pipe == 0) { 1789 + if (smc->os.hwm.txd_tx_pipe == NULL) { 1790 1790 smc->os.hwm.txd_tx_pipe = mb ; 1791 1791 } 1792 1792 else {
+1 -1
drivers/net/skfp/smt.c
··· 712 712 smc->mib.priv.fddiPRIVECF_Reply_Rx++ ; 713 713 DB_SMT("SMT: received ECF reply from %s\n", 714 714 addr_to_string(&sm->smt_source),0) ; 715 - if (sm_to_para(smc,sm,SMT_P_ECHODATA) == 0) { 715 + if (sm_to_para(smc,sm,SMT_P_ECHODATA) == NULL) { 716 716 DB_SMT("SMT: ECHODATA missing\n",0,0) ; 717 717 break ; 718 718 }
+1 -1
drivers/net/sungem.c
··· 3056 3056 netif_carrier_off(dev); 3057 3057 3058 3058 gp->regs = ioremap(gemreg_base, gemreg_len); 3059 - if (gp->regs == 0UL) { 3059 + if (!gp->regs) { 3060 3060 printk(KERN_ERR PFX "Cannot map device registers, " 3061 3061 "aborting.\n"); 3062 3062 err = -EIO;
+1 -1
drivers/net/sunhme.c
··· 3060 3060 goto err_out_clear_quattro; 3061 3061 } 3062 3062 3063 - if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == 0) { 3063 + if ((hpreg_base = ioremap(hpreg_res, 0x8000)) == NULL) { 3064 3064 printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n"); 3065 3065 goto err_out_free_res; 3066 3066 }
+1 -1
drivers/net/tg3.c
··· 12675 12675 tg3reg_len = pci_resource_len(pdev, 2); 12676 12676 12677 12677 tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len); 12678 - if (tp->aperegs == 0UL) { 12678 + if (!tp->aperegs) { 12679 12679 printk(KERN_ERR PFX "Cannot map APE registers, " 12680 12680 "aborting.\n"); 12681 12681 err = -ENOMEM;
+2 -2
drivers/net/tokenring/smctr.c
··· 2310 2310 && (tp->acb_head->subcmd 2311 2311 == RW_TRC_STATUS_BLOCK)) 2312 2312 { 2313 - if(tp->ptr_bcn_type != 0) 2313 + if(tp->ptr_bcn_type) 2314 2314 { 2315 2315 *(tp->ptr_bcn_type) 2316 2316 = (__u32)((SBlock *)tp->misc_command_data)->BCN_Type; ··· 2980 2980 return (UCODE_PRESENT); 2981 2981 2982 2982 /* Verify the firmware exists and is there in the right amount. */ 2983 - if((tp->ptr_ucode == 0L) 2983 + if (!tp->ptr_ucode 2984 2984 || (*(tp->ptr_ucode + UCODE_VERSION_OFFSET) < UCODE_VERSION)) 2985 2985 { 2986 2986 return (UCODE_NOT_PRESENT);
+3 -3
drivers/net/wan/lmc/lmc_main.c
··· 491 491 int pos; 492 492 int timeout = 500000; 493 493 494 - if(xc.data == 0x0){ 494 + if (!xc.data) { 495 495 ret = -EINVAL; 496 496 break; 497 497 } 498 498 499 499 data = kmalloc(xc.len, GFP_KERNEL); 500 - if(data == 0x0){ 500 + if (!data) { 501 501 printk(KERN_WARNING "%s: Failed to allocate memory for copy\n", dev->name); 502 502 ret = -ENOMEM; 503 503 break; ··· 1643 1643 * just allocate an skb buff and continue. 1644 1644 */ 1645 1645 1646 - if(skb == 0x0){ 1646 + if (!skb) { 1647 1647 nsb = dev_alloc_skb (LMC_PKT_BUF_SZ + 2); 1648 1648 if (nsb) { 1649 1649 sc->lmc_rxq[i] = nsb;
+2 -6
drivers/net/wan/lmc/lmc_media.c
··· 1219 1219 static void 1220 1220 lmc_set_protocol (lmc_softc_t * const sc, lmc_ctl_t * ctl) 1221 1221 { 1222 - if (ctl == 0) 1223 - { 1224 - sc->ictl.keepalive_onoff = LMC_CTL_ON; 1225 - 1226 - return; 1227 - } 1222 + if (!ctl) 1223 + sc->ictl.keepalive_onoff = LMC_CTL_ON; 1228 1224 }
+4 -4
drivers/net/wan/pc300_drv.c
··· 2365 2365 2366 2366 static irqreturn_t cpc_intr(int irq, void *dev_id) 2367 2367 { 2368 - pc300_t *card; 2368 + pc300_t *card = dev_id; 2369 2369 volatile ucchar plx_status; 2370 2370 2371 - if ((card = (pc300_t *) dev_id) == 0) { 2371 + if (!card) { 2372 2372 #ifdef PC300_DEBUG_INTR 2373 2373 printk("cpc_intr: spurious intr %d\n", irq); 2374 2374 #endif 2375 2375 return IRQ_NONE; /* spurious intr */ 2376 2376 } 2377 2377 2378 - if (card->hw.rambase == 0) { 2378 + if (!card->hw.rambase) { 2379 2379 #ifdef PC300_DEBUG_INTR 2380 2380 printk("cpc_intr: spurious intr2 %d\n", irq); 2381 2381 #endif ··· 3648 3648 { 3649 3649 pc300_t *card = pci_get_drvdata(pdev); 3650 3650 3651 - if (card->hw.rambase != 0) { 3651 + if (card->hw.rambase) { 3652 3652 int i; 3653 3653 3654 3654 /* Disable interrupts on the PCI bridge */
+6 -6
drivers/net/wan/pc300_tty.c
··· 313 313 if (cpc_tty->num_open == 0) { /* first open of this tty */ 314 314 if (!cpc_tty_area[port].buf_tx){ 315 315 cpc_tty_area[port].buf_tx = kmalloc(CPC_TTY_MAX_MTU,GFP_KERNEL); 316 - if (cpc_tty_area[port].buf_tx == 0){ 316 + if (!cpc_tty_area[port].buf_tx) { 317 317 CPC_TTY_DBG("%s: error in memory allocation\n",cpc_tty->name); 318 318 return -ENOMEM; 319 319 } ··· 678 678 for (j=0; j < CPC_TTY_NPORTS; j++) { 679 679 cpc_tty = &cpc_tty_area[port]; 680 680 681 - if ((buf=cpc_tty->buf_rx.first) != 0) { 681 + if ((buf=cpc_tty->buf_rx.first) != NULL) { 682 682 if (cpc_tty->tty) { 683 683 ld = tty_ldisc_ref(cpc_tty->tty); 684 684 if (ld) { ··· 784 784 } 785 785 786 786 new = kmalloc(rx_len + sizeof(st_cpc_rx_buf), GFP_ATOMIC); 787 - if (new == 0) { 787 + if (!new) { 788 788 cpc_tty_rx_disc_frame(pc300chan); 789 789 continue; 790 790 } ··· 863 863 } 864 864 new->size = rx_len; 865 865 new->next = NULL; 866 - if (cpc_tty->buf_rx.first == 0) { 866 + if (cpc_tty->buf_rx.first == NULL) { 867 867 cpc_tty->buf_rx.first = new; 868 868 cpc_tty->buf_rx.last = new; 869 869 } else { ··· 891 891 892 892 CPC_TTY_DBG("%s: cpc_tty_tx_work init\n",cpc_tty->name); 893 893 894 - if ((tty = cpc_tty->tty) == 0) { 894 + if ((tty = cpc_tty->tty) == NULL) { 895 895 CPC_TTY_DBG("%s: the interface is not opened\n",cpc_tty->name); 896 896 return; 897 897 } ··· 1027 1027 ulong flags; 1028 1028 int res; 1029 1029 1030 - if ((cpc_tty= (st_cpc_tty_area *) pc300dev->cpc_tty) == 0) { 1030 + if ((cpc_tty= (st_cpc_tty_area *) pc300dev->cpc_tty) == NULL) { 1031 1031 CPC_TTY_DBG("%s: interface is not TTY\n", pc300dev->dev->name); 1032 1032 return; 1033 1033 }
+1 -1
drivers/net/wireless/airo.c
··· 2032 2032 2033 2033 /* get a packet to send */ 2034 2034 2035 - if ((skb = skb_dequeue(&ai->txq)) == 0) { 2035 + if ((skb = skb_dequeue(&ai->txq)) == NULL) { 2036 2036 airo_print_err(dev->name, 2037 2037 "%s: Dequeue'd zero in send_packet()", 2038 2038 __FUNCTION__);
+1 -1
drivers/net/xen-netfront.c
··· 1073 1073 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 1074 1074 /* Do all the remapping work and M2P updates. */ 1075 1075 MULTI_mmu_update(mcl, np->rx_mmu, mmu - np->rx_mmu, 1076 - 0, DOMID_SELF); 1076 + NULL, DOMID_SELF); 1077 1077 mcl++; 1078 1078 HYPERVISOR_multicall(np->rx_mcl, mcl - np->rx_mcl); 1079 1079 }