ethernet: remove redundant memset
kvzalloc already zeroes the memory during the allocation.
pci_alloc_consistent calls dma_alloc_coherent directly.
In commit 518a2f1925
("dma-mapping: zero memory returned from dma_alloc_*"),
dma_alloc_coherent has already zeroed the memory.
So the memset after these function is not needed.
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cef86f1536
commit
3a5ee3b301
@ -1060,8 +1060,6 @@ static s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
|
||||
goto err_nomem;
|
||||
}
|
||||
|
||||
memset(ring_header->desc, 0, ring_header->size);
|
||||
|
||||
/* init TPD ring */
|
||||
tpd_ring->dma = ring_header->dma;
|
||||
offset = (tpd_ring->dma & 0x7) ? (8 - (ring_header->dma & 0x7)) : 0;
|
||||
|
@ -291,7 +291,6 @@ static s32 atl2_setup_ring_resources(struct atl2_adapter *adapter)
|
||||
&adapter->ring_dma);
|
||||
if (!adapter->ring_vir_addr)
|
||||
return -ENOMEM;
|
||||
memset(adapter->ring_vir_addr, 0, adapter->ring_size);
|
||||
|
||||
/* Init TXD Ring */
|
||||
adapter->txd_dma = adapter->ring_dma ;
|
||||
|
@ -2677,8 +2677,6 @@ static int bnxt_alloc_tx_rings(struct bnxt *bp)
|
||||
mapping = txr->tx_push_mapping +
|
||||
sizeof(struct tx_push_bd);
|
||||
txr->data_mapping = cpu_to_le64(mapping);
|
||||
|
||||
memset(txr->tx_push, 0, sizeof(struct tx_push_bd));
|
||||
}
|
||||
qidx = bp->tc_to_qidx[j];
|
||||
ring->queue_id = bp->q_info[qidx].queue_id;
|
||||
|
@ -207,7 +207,6 @@ static int t4_sched_queue_bind(struct port_info *pi, struct ch_sched_queue *p)
|
||||
goto out_err;
|
||||
|
||||
/* Bind queue to specified class */
|
||||
memset(qe, 0, sizeof(*qe));
|
||||
qe->cntxt_id = qid;
|
||||
memcpy(&qe->param, p, sizeof(qe->param));
|
||||
|
||||
|
@ -3144,8 +3144,6 @@ static int fec_enet_init(struct net_device *ndev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(cbd_base, 0, bd_size);
|
||||
|
||||
/* Get the Ethernet address */
|
||||
fec_get_mac(ndev);
|
||||
/* make sure MAC we just acquired is programmed into the hw */
|
||||
|
@ -582,11 +582,6 @@ jme_setup_tx_resources(struct jme_adapter *jme)
|
||||
if (unlikely(!(txring->bufinf)))
|
||||
goto err_free_txring;
|
||||
|
||||
/*
|
||||
* Initialize Transmit Descriptors
|
||||
*/
|
||||
memset(txring->alloc, 0, TX_RING_ALLOC_SIZE(jme->tx_ring_size));
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_txring:
|
||||
|
@ -2558,8 +2558,6 @@ static int skge_up(struct net_device *dev)
|
||||
goto free_pci_mem;
|
||||
}
|
||||
|
||||
memset(skge->mem, 0, skge->mem_size);
|
||||
|
||||
err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma);
|
||||
if (err)
|
||||
goto free_pci_mem;
|
||||
|
@ -1013,8 +1013,6 @@ static int mlx4_create_eq(struct mlx4_dev *dev, int nent,
|
||||
|
||||
dma_list[i] = t;
|
||||
eq->page_list[i].map = t;
|
||||
|
||||
memset(eq->page_list[i].buf, 0, PAGE_SIZE);
|
||||
}
|
||||
|
||||
eq->eqn = mlx4_bitmap_alloc(&priv->eq_table.bitmap);
|
||||
|
@ -2450,7 +2450,6 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
|
||||
MLX5_SET(query_vport_counter_in, in, vport_number, vport->vport);
|
||||
MLX5_SET(query_vport_counter_in, in, other_vport, 1);
|
||||
|
||||
memset(out, 0, outlen);
|
||||
err = mlx5_cmd_exec(esw->dev, in, sizeof(in), out, outlen);
|
||||
if (err)
|
||||
goto free_out;
|
||||
|
@ -1134,7 +1134,6 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
|
||||
}
|
||||
|
||||
/* create send-to-vport group */
|
||||
memset(flow_group_in, 0, inlen);
|
||||
MLX5_SET(create_flow_group_in, flow_group_in, match_criteria_enable,
|
||||
MLX5_MATCH_MISC_PARAMETERS);
|
||||
|
||||
@ -1293,8 +1292,6 @@ static int esw_create_vport_rx_group(struct mlx5_eswitch *esw, int nvports)
|
||||
return -ENOMEM;
|
||||
|
||||
/* create vport rx group */
|
||||
memset(flow_group_in, 0, inlen);
|
||||
|
||||
esw_set_flow_group_source_port(esw, flow_group_in);
|
||||
|
||||
MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 0);
|
||||
|
@ -847,7 +847,6 @@ static int mlxsw_pci_queue_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
|
||||
&mem_item->mapaddr);
|
||||
if (!mem_item->buf)
|
||||
return -ENOMEM;
|
||||
memset(mem_item->buf, 0, mem_item->size);
|
||||
|
||||
q->elem_info = kcalloc(q->count, sizeof(*q->elem_info), GFP_KERNEL);
|
||||
if (!q->elem_info) {
|
||||
|
@ -747,7 +747,6 @@ static int init_shared_mem(struct s2io_nic *nic)
|
||||
return -ENOMEM;
|
||||
}
|
||||
mem_allocated += size;
|
||||
memset(tmp_v_addr, 0, size);
|
||||
|
||||
size = sizeof(struct rxd_info) *
|
||||
rxd_count[nic->rxd_mode];
|
||||
|
@ -442,10 +442,8 @@ nx_fw_cmd_create_tx_ctx(struct netxen_adapter *adapter)
|
||||
goto out_free_rq;
|
||||
}
|
||||
|
||||
memset(rq_addr, 0, rq_size);
|
||||
prq = rq_addr;
|
||||
|
||||
memset(rsp_addr, 0, rsp_size);
|
||||
prsp = rsp_addr;
|
||||
|
||||
prq->host_rsp_dma_addr = cpu_to_le64(rsp_phys_addr);
|
||||
@ -755,7 +753,6 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(addr, 0, sizeof(struct netxen_ring_ctx));
|
||||
recv_ctx->hwctx = addr;
|
||||
recv_ctx->hwctx->ctx_id = cpu_to_le32(port);
|
||||
recv_ctx->hwctx->cmd_consumer_offset =
|
||||
|
@ -855,7 +855,6 @@ static int tlan_init(struct net_device *dev)
|
||||
dev->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(priv->dma_storage, 0, dma_size);
|
||||
priv->rx_list = (struct tlan_list *)
|
||||
ALIGN((unsigned long)priv->dma_storage, 8);
|
||||
priv->rx_list_dma = ALIGN(priv->dma_storage_dma, 8);
|
||||
|
Loading…
Reference in New Issue
Block a user