Commit 3b63ef7b authored by David S. Miller's avatar David S. Miller

Merge branch 'net-amd-static-checker-warnings'

Haoyue Xu says:

====================
net: amd: Cleanup for clearing static warnings

Most static warnings are detected by tools, mainly about:

(1) #1: About the if stament.
(2) #2: About the spelling.
(2) #3: About the indent.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 454e7b13 78923e8a
...@@ -695,7 +695,7 @@ static int a2065_init_one(struct zorro_dev *z, ...@@ -695,7 +695,7 @@ static int a2065_init_one(struct zorro_dev *z,
} }
dev = alloc_etherdev(sizeof(struct lance_private)); dev = alloc_etherdev(sizeof(struct lance_private));
if (dev == NULL) { if (!dev) {
release_mem_region(base_addr, sizeof(struct lance_regs)); release_mem_region(base_addr, sizeof(struct lance_regs));
release_mem_region(mem_start, A2065_RAM_SIZE); release_mem_region(mem_start, A2065_RAM_SIZE);
return -ENOMEM; return -ENOMEM;
......
...@@ -43,7 +43,7 @@ Revision History: ...@@ -43,7 +43,7 @@ Revision History:
3.0.4 12/09/2003 3.0.4 12/09/2003
1. Added set_mac_address routine for bonding driver support. 1. Added set_mac_address routine for bonding driver support.
2. Tested the driver for bonding support 2. Tested the driver for bonding support
3. Bug fix: Fixed mismach in actual receive buffer lenth and lenth 3. Bug fix: Fixed mismach in actual receive buffer length and length
indicated to the h/w. indicated to the h/w.
4. Modified amd8111e_rx() routine to receive all the received packets 4. Modified amd8111e_rx() routine to receive all the received packets
in the first interrupt. in the first interrupt.
...@@ -185,7 +185,6 @@ static void amd8111e_set_ext_phy(struct net_device *dev) ...@@ -185,7 +185,6 @@ static void amd8111e_set_ext_phy(struct net_device *dev)
advert = amd8111e_mdio_read(dev, lp->ext_phy_addr, MII_ADVERTISE); advert = amd8111e_mdio_read(dev, lp->ext_phy_addr, MII_ADVERTISE);
tmp = advert & ~(ADVERTISE_ALL | ADVERTISE_100BASE4); tmp = advert & ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
switch (lp->ext_phy_option) { switch (lp->ext_phy_option) {
default: default:
case SPEED_AUTONEG: /* advertise all values */ case SPEED_AUTONEG: /* advertise all values */
tmp |= (ADVERTISE_10HALF | ADVERTISE_10FULL | tmp |= (ADVERTISE_10HALF | ADVERTISE_10FULL |
...@@ -237,7 +236,7 @@ static int amd8111e_free_skbs(struct net_device *dev) ...@@ -237,7 +236,7 @@ static int amd8111e_free_skbs(struct net_device *dev)
/* Freeing previously allocated receive buffers */ /* Freeing previously allocated receive buffers */
for (i = 0; i < NUM_RX_BUFFERS; i++) { for (i = 0; i < NUM_RX_BUFFERS; i++) {
rx_skbuff = lp->rx_skbuff[i]; rx_skbuff = lp->rx_skbuff[i];
if (rx_skbuff != NULL) { if (rx_skbuff) {
dma_unmap_single(&lp->pci_dev->dev, dma_unmap_single(&lp->pci_dev->dev,
lp->rx_dma_addr[i], lp->rx_dma_addr[i],
lp->rx_buff_len - 2, DMA_FROM_DEVICE); lp->rx_buff_len - 2, DMA_FROM_DEVICE);
...@@ -1084,7 +1083,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id) ...@@ -1084,7 +1083,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
unsigned int intr0, intren0; unsigned int intr0, intren0;
unsigned int handled = 1; unsigned int handled = 1;
if (unlikely(dev == NULL)) if (unlikely(!dev))
return IRQ_NONE; return IRQ_NONE;
spin_lock(&lp->lock); spin_lock(&lp->lock);
...@@ -1109,7 +1108,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id) ...@@ -1109,7 +1108,7 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
/* Check if Receive Interrupt has occurred. */ /* Check if Receive Interrupt has occurred. */
if (intr0 & RINT0) { if (intr0 & RINT0) {
if (napi_schedule_prep(&lp->napi)) { if (napi_schedule_prep(&lp->napi)) {
/* Disable receive interupts */ /* Disable receive interrupts */
writel(RINTEN0, mmio + INTEN0); writel(RINTEN0, mmio + INTEN0);
/* Schedule a polling routine */ /* Schedule a polling routine */
__napi_schedule(&lp->napi); __napi_schedule(&lp->napi);
...@@ -1554,7 +1553,7 @@ static int amd8111e_enable_magicpkt(struct amd8111e_priv *lp) ...@@ -1554,7 +1553,7 @@ static int amd8111e_enable_magicpkt(struct amd8111e_priv *lp)
static int amd8111e_enable_link_change(struct amd8111e_priv *lp) static int amd8111e_enable_link_change(struct amd8111e_priv *lp)
{ {
/* Adapter is already stoped/suspended/interrupt-disabled */ /* Adapter is already stopped/suspended/interrupt-disabled */
writel(VAL0 | LCMODE_SW, lp->mmio + CMD7); writel(VAL0 | LCMODE_SW, lp->mmio + CMD7);
/* To eliminate PCI posting bug */ /* To eliminate PCI posting bug */
......
...@@ -600,7 +600,7 @@ typedef enum { ...@@ -600,7 +600,7 @@ typedef enum {
#define CSTATE 1 #define CSTATE 1
#define SSTATE 2 #define SSTATE 2
/* Assume contoller gets data 10 times the maximum processing time */ /* Assume controller gets data 10 times the maximum processing time */
#define REPEAT_CNT 10 #define REPEAT_CNT 10
/* amd8111e descriptor flag definitions */ /* amd8111e descriptor flag definitions */
......
...@@ -193,7 +193,7 @@ static int ariadne_rx(struct net_device *dev) ...@@ -193,7 +193,7 @@ static int ariadne_rx(struct net_device *dev)
struct sk_buff *skb; struct sk_buff *skb;
skb = netdev_alloc_skb(dev, pkt_len + 2); skb = netdev_alloc_skb(dev, pkt_len + 2);
if (skb == NULL) { if (!skb) {
for (i = 0; i < RX_RING_SIZE; i++) for (i = 0; i < RX_RING_SIZE; i++)
if (lowb(priv->rx_ring[(entry + i) % RX_RING_SIZE]->RMD1) & RF_OWN) if (lowb(priv->rx_ring[(entry + i) % RX_RING_SIZE]->RMD1) & RF_OWN)
break; break;
...@@ -731,7 +731,7 @@ static int ariadne_init_one(struct zorro_dev *z, ...@@ -731,7 +731,7 @@ static int ariadne_init_one(struct zorro_dev *z,
} }
dev = alloc_etherdev(sizeof(struct ariadne_private)); dev = alloc_etherdev(sizeof(struct ariadne_private));
if (dev == NULL) { if (!dev) {
release_mem_region(base_addr, sizeof(struct Am79C960)); release_mem_region(base_addr, sizeof(struct Am79C960));
release_mem_region(mem_start, ARIADNE_RAM_SIZE); release_mem_region(mem_start, ARIADNE_RAM_SIZE);
return -ENOMEM; return -ENOMEM;
......
...@@ -854,7 +854,7 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id ) ...@@ -854,7 +854,7 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
int csr0, boguscnt = 10; int csr0, boguscnt = 10;
int handled = 0; int handled = 0;
if (dev == NULL) { if (!dev) {
DPRINTK( 1, ( "lance_interrupt(): interrupt for unknown device.\n" )); DPRINTK( 1, ( "lance_interrupt(): interrupt for unknown device.\n" ));
return IRQ_NONE; return IRQ_NONE;
} }
...@@ -995,7 +995,7 @@ static int lance_rx( struct net_device *dev ) ...@@ -995,7 +995,7 @@ static int lance_rx( struct net_device *dev )
} }
else { else {
skb = netdev_alloc_skb(dev, pkt_len + 2); skb = netdev_alloc_skb(dev, pkt_len + 2);
if (skb == NULL) { if (!skb) {
for( i = 0; i < RX_RING_SIZE; i++ ) for( i = 0; i < RX_RING_SIZE; i++ )
if (MEM->rx_head[(entry+i) & RX_RING_MOD_MASK].flag & if (MEM->rx_head[(entry+i) & RX_RING_MOD_MASK].flag &
RMD1_OWN_CHIP) RMD1_OWN_CHIP)
......
...@@ -786,7 +786,7 @@ static int au1000_rx(struct net_device *dev) ...@@ -786,7 +786,7 @@ static int au1000_rx(struct net_device *dev)
frmlen = (status & RX_FRAME_LEN_MASK); frmlen = (status & RX_FRAME_LEN_MASK);
frmlen -= 4; /* Remove FCS */ frmlen -= 4; /* Remove FCS */
skb = netdev_alloc_skb(dev, frmlen + 2); skb = netdev_alloc_skb(dev, frmlen + 2);
if (skb == NULL) { if (!skb) {
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
continue; continue;
} }
...@@ -1199,7 +1199,7 @@ static int au1000_probe(struct platform_device *pdev) ...@@ -1199,7 +1199,7 @@ static int au1000_probe(struct platform_device *pdev)
} }
aup->mii_bus = mdiobus_alloc(); aup->mii_bus = mdiobus_alloc();
if (aup->mii_bus == NULL) { if (!aup->mii_bus) {
dev_err(&pdev->dev, "failed to allocate mdiobus structure\n"); dev_err(&pdev->dev, "failed to allocate mdiobus structure\n");
err = -ENOMEM; err = -ENOMEM;
goto err_mdiobus_alloc; goto err_mdiobus_alloc;
...@@ -1284,7 +1284,7 @@ static int au1000_probe(struct platform_device *pdev) ...@@ -1284,7 +1284,7 @@ static int au1000_probe(struct platform_device *pdev)
return 0; return 0;
err_out: err_out:
if (aup->mii_bus != NULL) if (aup->mii_bus)
mdiobus_unregister(aup->mii_bus); mdiobus_unregister(aup->mii_bus);
/* here we should have a valid dev plus aup-> register addresses /* here we should have a valid dev plus aup-> register addresses
......
...@@ -880,7 +880,7 @@ lance_init_ring(struct net_device *dev, gfp_t gfp) ...@@ -880,7 +880,7 @@ lance_init_ring(struct net_device *dev, gfp_t gfp)
rx_buff = skb->data; rx_buff = skb->data;
else else
rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp); rx_buff = kmalloc(PKT_BUF_SZ, GFP_DMA | gfp);
if (rx_buff == NULL) if (!rx_buff)
lp->rx_ring[i].base = 0; lp->rx_ring[i].base = 0;
else else
lp->rx_ring[i].base = (u32)isa_virt_to_bus(rx_buff) | 0x80000000; lp->rx_ring[i].base = (u32)isa_virt_to_bus(rx_buff) | 0x80000000;
...@@ -1186,7 +1186,7 @@ lance_rx(struct net_device *dev) ...@@ -1186,7 +1186,7 @@ lance_rx(struct net_device *dev)
else else
{ {
skb = dev_alloc_skb(pkt_len+2); skb = dev_alloc_skb(pkt_len+2);
if (skb == NULL) if (!skb)
{ {
printk("%s: Memory squeeze, deferring packet.\n", dev->name); printk("%s: Memory squeeze, deferring packet.\n", dev->name);
for (i=0; i < RX_RING_SIZE; i++) for (i=0; i < RX_RING_SIZE; i++)
......
...@@ -918,7 +918,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) ...@@ -918,7 +918,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
int status; int status;
int IntrCnt = MACE_MAX_IR_ITERATIONS; int IntrCnt = MACE_MAX_IR_ITERATIONS;
if (dev == NULL) { if (!dev) {
pr_debug("mace_interrupt(): irq 0x%X for unknown device.\n", pr_debug("mace_interrupt(): irq 0x%X for unknown device.\n",
irq); irq);
return IRQ_NONE; return IRQ_NONE;
...@@ -1102,7 +1102,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) ...@@ -1102,7 +1102,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt)
skb = netdev_alloc_skb(dev, pkt_len + 2); skb = netdev_alloc_skb(dev, pkt_len + 2);
if (skb != NULL) { if (skb) {
skb_reserve(skb, 2); skb_reserve(skb, 2);
insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1);
if (pkt_len & 1) if (pkt_len & 1)
......
...@@ -488,7 +488,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, ...@@ -488,7 +488,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev,
dma_alloc_coherent(&lp->pci_dev->dev, dma_alloc_coherent(&lp->pci_dev->dev,
sizeof(struct pcnet32_tx_head) * entries, sizeof(struct pcnet32_tx_head) * entries,
&new_ring_dma_addr, GFP_ATOMIC); &new_ring_dma_addr, GFP_ATOMIC);
if (new_tx_ring == NULL) if (!new_tx_ring)
return; return;
new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC); new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC);
...@@ -547,7 +547,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, ...@@ -547,7 +547,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev,
dma_alloc_coherent(&lp->pci_dev->dev, dma_alloc_coherent(&lp->pci_dev->dev,
sizeof(struct pcnet32_rx_head) * entries, sizeof(struct pcnet32_rx_head) * entries,
&new_ring_dma_addr, GFP_ATOMIC); &new_ring_dma_addr, GFP_ATOMIC);
if (new_rx_ring == NULL) if (!new_rx_ring)
return; return;
new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC); new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC);
...@@ -1249,7 +1249,7 @@ static void pcnet32_rx_entry(struct net_device *dev, ...@@ -1249,7 +1249,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
} else } else
skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN); skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN);
if (skb == NULL) { if (!skb) {
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
...@@ -2018,7 +2018,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) ...@@ -2018,7 +2018,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
lp->tx_ring = dma_alloc_coherent(&lp->pci_dev->dev, lp->tx_ring = dma_alloc_coherent(&lp->pci_dev->dev,
sizeof(struct pcnet32_tx_head) * lp->tx_ring_size, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size,
&lp->tx_ring_dma_addr, GFP_KERNEL); &lp->tx_ring_dma_addr, GFP_KERNEL);
if (lp->tx_ring == NULL) { if (!lp->tx_ring) {
netif_err(lp, drv, dev, "Coherent memory allocation failed\n"); netif_err(lp, drv, dev, "Coherent memory allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -2026,7 +2026,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) ...@@ -2026,7 +2026,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
lp->rx_ring = dma_alloc_coherent(&lp->pci_dev->dev, lp->rx_ring = dma_alloc_coherent(&lp->pci_dev->dev,
sizeof(struct pcnet32_rx_head) * lp->rx_ring_size, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size,
&lp->rx_ring_dma_addr, GFP_KERNEL); &lp->rx_ring_dma_addr, GFP_KERNEL);
if (lp->rx_ring == NULL) { if (!lp->rx_ring) {
netif_err(lp, drv, dev, "Coherent memory allocation failed\n"); netif_err(lp, drv, dev, "Coherent memory allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -2365,7 +2365,7 @@ static int pcnet32_init_ring(struct net_device *dev) ...@@ -2365,7 +2365,7 @@ static int pcnet32_init_ring(struct net_device *dev)
for (i = 0; i < lp->rx_ring_size; i++) { for (i = 0; i < lp->rx_ring_size; i++) {
struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; struct sk_buff *rx_skbuff = lp->rx_skbuff[i];
if (rx_skbuff == NULL) { if (!rx_skbuff) {
lp->rx_skbuff[i] = netdev_alloc_skb(dev, PKT_BUF_SKB); lp->rx_skbuff[i] = netdev_alloc_skb(dev, PKT_BUF_SKB);
rx_skbuff = lp->rx_skbuff[i]; rx_skbuff = lp->rx_skbuff[i];
if (!rx_skbuff) { if (!rx_skbuff) {
......
...@@ -341,7 +341,7 @@ static int __init lance_probe( struct net_device *dev) ...@@ -341,7 +341,7 @@ static int __init lance_probe( struct net_device *dev)
/* XXX - leak? */ /* XXX - leak? */
MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
if (MEM == NULL) { if (!MEM) {
#ifdef CONFIG_SUN3 #ifdef CONFIG_SUN3
iounmap((void __iomem *)ioaddr); iounmap((void __iomem *)ioaddr);
#endif #endif
...@@ -796,7 +796,7 @@ static int lance_rx( struct net_device *dev ) ...@@ -796,7 +796,7 @@ static int lance_rx( struct net_device *dev )
} }
else { else {
skb = netdev_alloc_skb(dev, pkt_len + 2); skb = netdev_alloc_skb(dev, pkt_len + 2);
if (skb == NULL) { if (!skb) {
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
head->msg_length = 0; head->msg_length = 0;
head->flag |= RMD1_OWN_CHIP; head->flag |= RMD1_OWN_CHIP;
......
...@@ -530,7 +530,7 @@ static void lance_rx_dvma(struct net_device *dev) ...@@ -530,7 +530,7 @@ static void lance_rx_dvma(struct net_device *dev)
len = (rd->mblength & 0xfff) - 4; len = (rd->mblength & 0xfff) - 4;
skb = netdev_alloc_skb(dev, len + 2); skb = netdev_alloc_skb(dev, len + 2);
if (skb == NULL) { if (!skb) {
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
rd->mblength = 0; rd->mblength = 0;
rd->rmd1_bits = LE_R1_OWN; rd->rmd1_bits = LE_R1_OWN;
...@@ -700,7 +700,7 @@ static void lance_rx_pio(struct net_device *dev) ...@@ -700,7 +700,7 @@ static void lance_rx_pio(struct net_device *dev)
len = (sbus_readw(&rd->mblength) & 0xfff) - 4; len = (sbus_readw(&rd->mblength) & 0xfff) - 4;
skb = netdev_alloc_skb(dev, len + 2); skb = netdev_alloc_skb(dev, len + 2);
if (skb == NULL) { if (!skb) {
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
sbus_writew(0, &rd->mblength); sbus_writew(0, &rd->mblength);
sbus_writeb(LE_R1_OWN, &rd->rmd1_bits); sbus_writeb(LE_R1_OWN, &rd->rmd1_bits);
......
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