Commit 33deb13c authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Jakub Kicinski

ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc()

Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 64a99fe5
...@@ -2203,7 +2203,7 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) ...@@ -2203,7 +2203,7 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth)
for (j = 0; j < ug_info->numQueuesTx; j++) { for (j = 0; j < ug_info->numQueuesTx; j++) {
/* Setup the skbuff rings */ /* Setup the skbuff rings */
ugeth->tx_skbuff[j] = ugeth->tx_skbuff[j] =
kmalloc_array(ugeth->ug_info->bdRingLenTx[j], kcalloc(ugeth->ug_info->bdRingLenTx[j],
sizeof(struct sk_buff *), GFP_KERNEL); sizeof(struct sk_buff *), GFP_KERNEL);
if (ugeth->tx_skbuff[j] == NULL) { if (ugeth->tx_skbuff[j] == NULL) {
...@@ -2212,9 +2212,6 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) ...@@ -2212,9 +2212,6 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth)
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < ugeth->ug_info->bdRingLenTx[j]; i++)
ugeth->tx_skbuff[j][i] = NULL;
ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0; ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0;
bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j];
for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { for (i = 0; i < ug_info->bdRingLenTx[j]; i++) {
...@@ -2266,7 +2263,7 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) ...@@ -2266,7 +2263,7 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth)
for (j = 0; j < ug_info->numQueuesRx; j++) { for (j = 0; j < ug_info->numQueuesRx; j++) {
/* Setup the skbuff rings */ /* Setup the skbuff rings */
ugeth->rx_skbuff[j] = ugeth->rx_skbuff[j] =
kmalloc_array(ugeth->ug_info->bdRingLenRx[j], kcalloc(ugeth->ug_info->bdRingLenRx[j],
sizeof(struct sk_buff *), GFP_KERNEL); sizeof(struct sk_buff *), GFP_KERNEL);
if (ugeth->rx_skbuff[j] == NULL) { if (ugeth->rx_skbuff[j] == NULL) {
...@@ -2275,9 +2272,6 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) ...@@ -2275,9 +2272,6 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth)
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < ugeth->ug_info->bdRingLenRx[j]; i++)
ugeth->rx_skbuff[j][i] = NULL;
ugeth->skb_currx[j] = 0; ugeth->skb_currx[j] = 0;
bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j];
for (i = 0; i < ug_info->bdRingLenRx[j]; i++) { for (i = 0; i < ug_info->bdRingLenRx[j]; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment