From 773bc97397ea2cfc2ff3c075f712aaf376ed7cb0 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sun, 22 Aug 2010 00:54:30 -0700 Subject: tokenring: remove unneeded NULL checks "fw_entry" is always non-NULL at this point and anyway release_firmware() handles NULL parameters. Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- drivers/net/tokenring/tms380tr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/net/tokenring/tms380tr.c') diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index 435ef7d5470f..08182fde3dcd 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c @@ -1321,14 +1321,12 @@ static int tms380tr_reset_adapter(struct net_device *dev) /* Clear CPHALT and start BUD */ SIFWRITEW(c, SIFACL); - if (fw_entry) - release_firmware(fw_entry); + release_firmware(fw_entry); return (1); } } while(count == 0); - if (fw_entry) - release_firmware(fw_entry); + release_firmware(fw_entry); printk(KERN_INFO "%s: Adapter Download Failed\n", dev->name); return (-1); } -- cgit v1.2.3 From 807540baae406c84dcb9c1c8ef07a56d2d2ae84a Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Thu, 23 Sep 2010 05:40:09 +0000 Subject: drivers/net: return operator cleanup Change "return (EXPR);" to "return EXPR;" return is not a function, parentheses are not required. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- drivers/net/tokenring/tms380tr.c | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'drivers/net/tokenring/tms380tr.c') diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index 08182fde3dcd..c83f4f6e39e1 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c @@ -224,7 +224,7 @@ static int madgemc_sifprobe(struct net_device *dev) chk2 ^= 0x0FE; if(chk1 != chk2) - return (-1); /* No adapter */ + return -1; /* No adapter */ chk1 -= 2; } while(chk1 != 0); /* Repeat 128 times (all byte values) */ @@ -232,7 +232,7 @@ static int madgemc_sifprobe(struct net_device *dev) /* Restore the SIFADR value */ SIFWRITEB(old, SIFADR); - return (0); + return 0; } #endif @@ -271,7 +271,7 @@ int tms380tr_open(struct net_device *dev) { printk(KERN_INFO "%s: Chipset initialization error\n", dev->name); - return (-1); + return -1; } tp->timer.expires = jiffies + 30*HZ; @@ -298,7 +298,7 @@ int tms380tr_open(struct net_device *dev) if(tp->AdapterVirtOpenFlag == 0) { tms380tr_disable_interrupts(dev); - return (-1); + return -1; } tp->StartTime = jiffies; @@ -309,7 +309,7 @@ int tms380tr_open(struct net_device *dev) tp->timer.data = (unsigned long)dev; add_timer(&tp->timer); - return (0); + return 0; } /* @@ -343,23 +343,23 @@ static int tms380tr_chipset_init(struct net_device *dev) printk(KERN_DEBUG "%s: Resetting adapter...\n", dev->name); err = tms380tr_reset_adapter(dev); if(err < 0) - return (-1); + return -1; if(tms380tr_debug > 3) printk(KERN_DEBUG "%s: Bringup diags...\n", dev->name); err = tms380tr_bringup_diags(dev); if(err < 0) - return (-1); + return -1; if(tms380tr_debug > 3) printk(KERN_DEBUG "%s: Init adapter...\n", dev->name); err = tms380tr_init_adapter(dev); if(err < 0) - return (-1); + return -1; if(tms380tr_debug > 3) printk(KERN_DEBUG "%s: Done!\n", dev->name); - return (0); + return 0; } /* @@ -877,7 +877,7 @@ static unsigned char tms380tr_chk_ssb(struct net_local *tp, unsigned short IrqTy IrqType != STS_IRQ_COMMAND_STATUS && IrqType != STS_IRQ_RING_STATUS) { - return (1); /* SSB not involved. */ + return 1; /* SSB not involved. */ } /* Note: All fields of the SSB have been set to all ones (-1) after it @@ -887,21 +887,21 @@ static unsigned char tms380tr_chk_ssb(struct net_local *tp, unsigned short IrqTy */ if(ssb->STS == (unsigned short) -1) - return (0); /* Command field not yet available. */ + return 0; /* Command field not yet available. */ if(IrqType == STS_IRQ_COMMAND_STATUS) - return (1); /* Status fields not always affected. */ + return 1; /* Status fields not always affected. */ if(ssb->Parm[0] == (unsigned short) -1) - return (0); /* Status 1 field not yet available. */ + return 0; /* Status 1 field not yet available. */ if(IrqType == STS_IRQ_RING_STATUS) - return (1); /* Status 2 & 3 fields not affected. */ + return 1; /* Status 2 & 3 fields not affected. */ /* Note: At this point, the interrupt is either TRANSMIT or RECEIVE. */ if(ssb->Parm[1] == (unsigned short) -1) - return (0); /* Status 2 field not yet available. */ + return 0; /* Status 2 field not yet available. */ if(ssb->Parm[2] == (unsigned short) -1) - return (0); /* Status 3 field not yet available. */ + return 0; /* Status 3 field not yet available. */ - return (1); /* All SSB fields have been written by the adapter. */ + return 1; /* All SSB fields have been written by the adapter. */ } /* @@ -1143,7 +1143,7 @@ int tms380tr_close(struct net_device *dev) #endif tms380tr_cancel_tx_queue(tp); - return (0); + return 0; } /* @@ -1154,7 +1154,7 @@ static struct net_device_stats *tms380tr_get_stats(struct net_device *dev) { struct net_local *tp = netdev_priv(dev); - return ((struct net_device_stats *)&tp->MacStat); + return (struct net_device_stats *)&tp->MacStat; } /* @@ -1256,7 +1256,7 @@ static int tms380tr_reset_adapter(struct net_device *dev) if (request_firmware(&fw_entry, "tms380tr.bin", tp->pdev) != 0) { printk(KERN_ALERT "%s: firmware %s is missing, cannot start.\n", dev->name, "tms380tr.bin"); - return (-1); + return -1; } fw_ptr = (unsigned short *)fw_entry->data; @@ -1322,13 +1322,13 @@ static int tms380tr_reset_adapter(struct net_device *dev) /* Clear CPHALT and start BUD */ SIFWRITEW(c, SIFACL); release_firmware(fw_entry); - return (1); + return 1; } } while(count == 0); release_firmware(fw_entry); printk(KERN_INFO "%s: Adapter Download Failed\n", dev->name); - return (-1); + return -1; } MODULE_FIRMWARE("tms380tr.bin"); @@ -1363,7 +1363,7 @@ static int tms380tr_bringup_diags(struct net_device *dev) printk(KERN_DEBUG " %04X\n", Status); /* BUD successfully completed */ if(Status == STS_INITIALIZE) - return (1); + return 1; /* Unrecoverable hardware error, BUD not completed? */ } while((loop_cnt > 0) && ((Status & (STS_ERROR | STS_TEST)) != (STS_ERROR | STS_TEST))); @@ -1390,7 +1390,7 @@ static int tms380tr_bringup_diags(struct net_device *dev) else printk(KERN_INFO "%s: Bring Up Diagnostics Error (%04X) occurred\n", dev->name, Status & 0x000f); - return (-1); + return -1; } /* @@ -1464,7 +1464,7 @@ static int tms380tr_init_adapter(struct net_device *dev) { printk(KERN_INFO "%s: DMA failed\n", dev->name); /* DMA data error: wrong data in SCB */ - return (-1); + return -1; } i++; } while(i < 6); @@ -1473,11 +1473,11 @@ static int tms380tr_init_adapter(struct net_device *dev) do { /* Test if contents of SSB is valid */ if(SSB_Test[i] != *(sb_ptr + i)) /* DMA data error: wrong data in SSB */ - return (-1); + return -1; i++; } while (i < 8); - return (1); /* Adapter successfully initialized */ + return 1; /* Adapter successfully initialized */ } else { @@ -1488,7 +1488,7 @@ static int tms380tr_init_adapter(struct net_device *dev) Status &= STS_ERROR_MASK; /* ShowInitialisationErrorCode(Status); */ printk(KERN_INFO "%s: Status error: %d\n", dev->name, Status); - return (-1); /* Unrecoverable error */ + return -1; /* Unrecoverable error */ } else { @@ -1503,7 +1503,7 @@ static int tms380tr_init_adapter(struct net_device *dev) } while(retry_cnt > 0); printk(KERN_INFO "%s: Retry exceeded\n", dev->name); - return (-1); + return -1; } /* -- cgit v1.2.3