From 78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 11 Feb 2013 09:41:29 -0800 Subject: staging: Remove unnecessary OOM messages alloc failures already get standardized OOM messages and a dump_stack. For the affected mallocs around these OOM messages: Converted kzallocs with multiplies to kcalloc. Converted kmallocs with multiplies to kmalloc_array. Converted a kmalloc/strlen/strncpy to kstrdup. Moved a spin_lock below a removed OOM message and removed a now unnecessary spin_unlock. Neatened alignment and whitespace. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 4a7c302..ebf5e49 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -2462,11 +2462,8 @@ static int et131x_init_recv(struct et131x_adapter *adapter) /* Setup each RFD */ for (rfdct = 0; rfdct < rx_ring->num_rfd; rfdct++) { rfd = kzalloc(sizeof(struct rfd), GFP_ATOMIC | GFP_DMA); - - if (!rfd) { - dev_err(&adapter->pdev->dev, "Couldn't alloc RFD\n"); + if (!rfd) return -ENOMEM; - } rfd->skb = NULL; @@ -2814,12 +2811,10 @@ static int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) struct tx_ring *tx_ring = &adapter->tx_ring; /* Allocate memory for the TCB's (Transmit Control Block) */ - adapter->tx_ring.tcb_ring = - kcalloc(NUM_TCB, sizeof(struct tcb), GFP_ATOMIC | GFP_DMA); - if (!adapter->tx_ring.tcb_ring) { - dev_err(&adapter->pdev->dev, "Cannot alloc memory for TCBs\n"); + adapter->tx_ring.tcb_ring = kcalloc(NUM_TCB, sizeof(struct tcb), + GFP_ATOMIC | GFP_DMA); + if (!adapter->tx_ring.tcb_ring) return -ENOMEM; - } desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX); tx_ring->tx_desc_ring = @@ -4895,11 +4890,10 @@ static int et131x_pci_setup(struct pci_dev *pdev, adapter->mii_bus->read = et131x_mdio_read; adapter->mii_bus->write = et131x_mdio_write; adapter->mii_bus->reset = et131x_mdio_reset; - adapter->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); - if (!adapter->mii_bus->irq) { - dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); + adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), + GFP_KERNEL); + if (!adapter->mii_bus->irq) goto err_mdio_free; - } for (ii = 0; ii < PHY_MAX_ADDR; ii++) adapter->mii_bus->irq[ii] = PHY_POLL; -- cgit v1.1