diff options
author | Joe Perches <joe@perches.com> | 2013-02-11 09:41:29 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-11 10:10:33 -0800 |
commit | 78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b (patch) | |
tree | 6534f66eb765163602ad1af98c651bea6ae09416 /drivers/staging/sbe-2t3e3 | |
parent | ad463ac42771a0bb8a706cf8a985788fe5f5c1c6 (diff) | |
download | op-kernel-dev-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.zip op-kernel-dev-78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b.tar.gz |
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 <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/sbe-2t3e3')
-rw-r--r-- | drivers/staging/sbe-2t3e3/dc.c | 9 | ||||
-rw-r--r-- | drivers/staging/sbe-2t3e3/module.c | 7 |
2 files changed, 6 insertions, 10 deletions
diff --git a/drivers/staging/sbe-2t3e3/dc.c b/drivers/staging/sbe-2t3e3/dc.c index daadd6e..f207b9e 100644 --- a/drivers/staging/sbe-2t3e3/dc.c +++ b/drivers/staging/sbe-2t3e3/dc.c @@ -315,20 +315,17 @@ static int dc_init_descriptor_list(struct channel *sc) struct sk_buff *m; if (sc->ether.rx_ring == NULL) - sc->ether.rx_ring = kzalloc(SBE_2T3E3_RX_DESC_RING_SIZE * + sc->ether.rx_ring = kcalloc(SBE_2T3E3_RX_DESC_RING_SIZE, sizeof(t3e3_rx_desc_t), GFP_KERNEL); - if (sc->ether.rx_ring == NULL) { - dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n"); + if (sc->ether.rx_ring == NULL) return -ENOMEM; - } if (sc->ether.tx_ring == NULL) - sc->ether.tx_ring = kzalloc(SBE_2T3E3_TX_DESC_RING_SIZE * + sc->ether.tx_ring = kcalloc(SBE_2T3E3_TX_DESC_RING_SIZE, sizeof(t3e3_tx_desc_t), GFP_KERNEL); if (sc->ether.tx_ring == NULL) { kfree(sc->ether.rx_ring); sc->ether.rx_ring = NULL; - dev_err(&sc->pdev->dev, "SBE 2T3E3: no buffer space for RX ring\n"); return -ENOMEM; } diff --git a/drivers/staging/sbe-2t3e3/module.c b/drivers/staging/sbe-2t3e3/module.c index ae7af39..0e32be5 100644 --- a/drivers/staging/sbe-2t3e3/module.c +++ b/drivers/staging/sbe-2t3e3/module.c @@ -154,11 +154,10 @@ static int t3e3_init_card(struct pci_dev *pdev, const struct pci_device_id *ent) /* holds the reference for pdev1 */ } - card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel), GFP_KERNEL); - if (!card) { - dev_err(&pdev->dev, "Out of memory\n"); + card = kzalloc(sizeof(struct card) + channels * sizeof(struct channel), + GFP_KERNEL); + if (!card) return -ENOBUFS; - } spin_lock_init(&card->bootrom_lock); card->bootrom_addr = pci_resource_start(pdev, 0); |