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>
This commit is contained in:
Al Viro 2008-01-24 02:06:46 -08:00 committed by David S. Miller
parent 3e18826c73
commit 79ea13ce07
24 changed files with 49 additions and 57 deletions

View 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),

View 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++;

View 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)
{

View 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));
}

View 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;
}

View 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],

View 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;
/*

View 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;
/*

View 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 */

View 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:

View 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;
}

View 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);

View 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 {

View 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 ;
}

View 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;

View 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;
}

View 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;

View 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);

View 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;

View 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;
}

View 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 */

View 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;
}

View 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__);

View 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);
}