ethernet: Remove unnecessary alloc/OOM messages, alloc cleanups
alloc failures already get standardized OOM messages and a dump_stack. Convert kzalloc's with multiplies to kcalloc. Convert kmalloc's with multiplies to kmalloc_array. Fix a few whitespace defects. Convert a constant 6 to ETH_ALEN. Use parentheses around sizeof. Convert vmalloc/memset to vzalloc. Remove now unused size variables. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
09da6c5f60
commit
b2adaca92c
@@ -1921,10 +1921,8 @@ static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
|
||||
u64 hret;
|
||||
|
||||
ehea_mcl_entry = kzalloc(sizeof(*ehea_mcl_entry), GFP_ATOMIC);
|
||||
if (!ehea_mcl_entry) {
|
||||
pr_err("no mem for mcl_entry\n");
|
||||
if (!ehea_mcl_entry)
|
||||
return;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&ehea_mcl_entry->list);
|
||||
|
||||
|
@@ -64,11 +64,10 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages,
|
||||
}
|
||||
|
||||
queue->queue_length = nr_of_pages * pagesize;
|
||||
queue->queue_pages = kmalloc(nr_of_pages * sizeof(void *), GFP_KERNEL);
|
||||
if (!queue->queue_pages) {
|
||||
pr_err("no mem for queue_pages\n");
|
||||
queue->queue_pages = kmalloc_array(nr_of_pages, sizeof(void *),
|
||||
GFP_KERNEL);
|
||||
if (!queue->queue_pages)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* allocate pages for queue:
|
||||
@@ -129,10 +128,8 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
|
||||
void *vpage;
|
||||
|
||||
cq = kzalloc(sizeof(*cq), GFP_KERNEL);
|
||||
if (!cq) {
|
||||
pr_err("no mem for cq\n");
|
||||
if (!cq)
|
||||
goto out_nomem;
|
||||
}
|
||||
|
||||
cq->attr.max_nr_of_cqes = nr_of_cqe;
|
||||
cq->attr.cq_token = cq_token;
|
||||
@@ -257,10 +254,8 @@ struct ehea_eq *ehea_create_eq(struct ehea_adapter *adapter,
|
||||
struct ehea_eq *eq;
|
||||
|
||||
eq = kzalloc(sizeof(*eq), GFP_KERNEL);
|
||||
if (!eq) {
|
||||
pr_err("no mem for eq\n");
|
||||
if (!eq)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
eq->adapter = adapter;
|
||||
eq->attr.type = type;
|
||||
@@ -428,10 +423,8 @@ struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter,
|
||||
|
||||
|
||||
qp = kzalloc(sizeof(*qp), GFP_KERNEL);
|
||||
if (!qp) {
|
||||
pr_err("no mem for qp\n");
|
||||
if (!qp)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qp->adapter = adapter;
|
||||
|
||||
|
@@ -528,12 +528,9 @@ static int mal_probe(struct platform_device *ofdev)
|
||||
irq_handler_t hdlr_serr, hdlr_txde, hdlr_rxde;
|
||||
|
||||
mal = kzalloc(sizeof(struct mal_instance), GFP_KERNEL);
|
||||
if (!mal) {
|
||||
printk(KERN_ERR
|
||||
"mal%d: out of memory allocating MAL structure!\n",
|
||||
index);
|
||||
if (!mal)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mal->index = index;
|
||||
mal->ofdev = ofdev;
|
||||
mal->version = of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal2") ? 2 : 1;
|
||||
|
@@ -637,7 +637,6 @@ static int ibmveth_open(struct net_device *netdev)
|
||||
adapter->bounce_buffer =
|
||||
kmalloc(netdev->mtu + IBMVETH_BUFF_OH, GFP_KERNEL);
|
||||
if (!adapter->bounce_buffer) {
|
||||
netdev_err(netdev, "unable to allocate bounce buffer\n");
|
||||
rc = -ENOMEM;
|
||||
goto err_out_free_irq;
|
||||
}
|
||||
|
Reference in New Issue
Block a user