All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()'
@ 2017-07-08  7:46 ` Christophe JAILLET
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

These patchs are all related to 'alloc_dma_[rt]x_desc_resources()' functions.

The 2 first fix an error path where some resources are leaking. I've
separated them into 2 patches because the issues have been introduced by
2 deferent commits.

The 3rd patch is just a clean-up.

Christophe JAILLET (3):
  net: stmmac: Fix error handling path in
    'alloc_dma_rx_desc_resources()'
  net: stmmac: Fix error handling path in
    'alloc_dma_tx_desc_resources()'
  net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()'
@ 2017-07-08  7:46 ` Christophe JAILLET
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

These patchs are all related to 'alloc_dma_[rt]x_desc_resources()' functions.

The 2 first fix an error path where some resources are leaking. I've
separated them into 2 patches because the issues have been introduced by
2 deferent commits.

The 3rd patch is just a clean-up.

Christophe JAILLET (3):
  net: stmmac: Fix error handling path in
    'alloc_dma_rx_desc_resources()'
  net: stmmac: Fix error handling path in
    'alloc_dma_tx_desc_resources()'
  net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'
  2017-07-08  7:46 ` Christophe JAILLET
@ 2017-07-08  7:46   ` Christophe JAILLET
  -1 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

If the first 'kmalloc_array' within the loop fails, we should free what
as already been allocated, as done in all other error handling path.

Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 19bba6281dab..4322fa4a13e8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(dma_addr_t),
 						    GFP_KERNEL);
 		if (!rx_q->rx_skbuff_dma)
-			return -ENOMEM;
+			goto err_dma;
 
 		rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
 						sizeof(struct sk_buff *),
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'
@ 2017-07-08  7:46   ` Christophe JAILLET
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

If the first 'kmalloc_array' within the loop fails, we should free what
as already been allocated, as done in all other error handling path.

Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 19bba6281dab..4322fa4a13e8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(dma_addr_t),
 						    GFP_KERNEL);
 		if (!rx_q->rx_skbuff_dma)
-			return -ENOMEM;
+			goto err_dma;
 
 		rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
 						sizeof(struct sk_buff *),
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()'
  2017-07-08  7:46 ` Christophe JAILLET
@ 2017-07-08  7:46   ` Christophe JAILLET
  -1 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

If the first 'kmalloc_array' within the loop fails, we should free what
as already been allocated, as done in all other error handling path.

Fixes: ce736788e8a9 ("net: stmmac: adding multiple buffers for TX")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4322fa4a13e8..07d486a70118 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1561,7 +1561,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(*tx_q->tx_skbuff_dma),
 						    GFP_KERNEL);
 		if (!tx_q->tx_skbuff_dma)
-			return -ENOMEM;
+			goto err_dma_buffers;
 
 		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
 						sizeof(struct sk_buff *),
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()'
@ 2017-07-08  7:46   ` Christophe JAILLET
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

If the first 'kmalloc_array' within the loop fails, we should free what
as already been allocated, as done in all other error handling path.

Fixes: ce736788e8a9 ("net: stmmac: adding multiple buffers for TX")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4322fa4a13e8..07d486a70118 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1561,7 +1561,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(*tx_q->tx_skbuff_dma),
 						    GFP_KERNEL);
 		if (!tx_q->tx_skbuff_dma)
-			return -ENOMEM;
+			goto err_dma_buffers;
 
 		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
 						sizeof(struct sk_buff *),
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer
  2017-07-08  7:46 ` Christophe JAILLET
@ 2017-07-08  7:46   ` Christophe JAILLET
  -1 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

'alloc_dma_[rt]x_desc_resources()' functions look very close.
Remove a useless initialization and use the same label name for error
handling path in order to get them even closer.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 07d486a70118..1853f7ff6657 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1449,7 +1449,7 @@ static void free_dma_rx_desc_resources(struct stmmac_priv *priv)
 static void free_dma_tx_desc_resources(struct stmmac_priv *priv)
 {
 	u32 tx_count = priv->plat->tx_queues_to_use;
-	u32 queue = 0;
+	u32 queue;
 
 	/* Free TX queue resources */
 	for (queue = 0; queue < tx_count; queue++) {
@@ -1561,13 +1561,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(*tx_q->tx_skbuff_dma),
 						    GFP_KERNEL);
 		if (!tx_q->tx_skbuff_dma)
-			goto err_dma_buffers;
+			goto err_dma;
 
 		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
 						sizeof(struct sk_buff *),
 						GFP_KERNEL);
 		if (!tx_q->tx_skbuff)
-			goto err_dma_buffers;
+			goto err_dma;
 
 		if (priv->extend_desc) {
 			tx_q->dma_etx = dma_zalloc_coherent(priv->device,
@@ -1577,7 +1577,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 							    &tx_q->dma_tx_phy,
 							    GFP_KERNEL);
 			if (!tx_q->dma_etx)
-				goto err_dma_buffers;
+				goto err_dma;
 		} else {
 			tx_q->dma_tx = dma_zalloc_coherent(priv->device,
 							   DMA_TX_SIZE *
@@ -1586,13 +1586,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 							   &tx_q->dma_tx_phy,
 							   GFP_KERNEL);
 			if (!tx_q->dma_tx)
-				goto err_dma_buffers;
+				goto err_dma;
 		}
 	}
 
 	return 0;
 
-err_dma_buffers:
+err_dma:
 	free_dma_tx_desc_resources(priv);
 
 	return ret;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer
@ 2017-07-08  7:46   ` Christophe JAILLET
  0 siblings, 0 replies; 16+ messages in thread
From: Christophe JAILLET @ 2017-07-08  7:46 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

'alloc_dma_[rt]x_desc_resources()' functions look very close.
Remove a useless initialization and use the same label name for error
handling path in order to get them even closer.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 07d486a70118..1853f7ff6657 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1449,7 +1449,7 @@ static void free_dma_rx_desc_resources(struct stmmac_priv *priv)
 static void free_dma_tx_desc_resources(struct stmmac_priv *priv)
 {
 	u32 tx_count = priv->plat->tx_queues_to_use;
-	u32 queue = 0;
+	u32 queue;
 
 	/* Free TX queue resources */
 	for (queue = 0; queue < tx_count; queue++) {
@@ -1561,13 +1561,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(*tx_q->tx_skbuff_dma),
 						    GFP_KERNEL);
 		if (!tx_q->tx_skbuff_dma)
-			goto err_dma_buffers;
+			goto err_dma;
 
 		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
 						sizeof(struct sk_buff *),
 						GFP_KERNEL);
 		if (!tx_q->tx_skbuff)
-			goto err_dma_buffers;
+			goto err_dma;
 
 		if (priv->extend_desc) {
 			tx_q->dma_etx = dma_zalloc_coherent(priv->device,
@@ -1577,7 +1577,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 							    &tx_q->dma_tx_phy,
 							    GFP_KERNEL);
 			if (!tx_q->dma_etx)
-				goto err_dma_buffers;
+				goto err_dma;
 		} else {
 			tx_q->dma_tx = dma_zalloc_coherent(priv->device,
 							   DMA_TX_SIZE *
@@ -1586,13 +1586,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
 							   &tx_q->dma_tx_phy,
 							   GFP_KERNEL);
 			if (!tx_q->dma_tx)
-				goto err_dma_buffers;
+				goto err_dma;
 		}
 	}
 
 	return 0;
 
-err_dma_buffers:
+err_dma:
 	free_dma_tx_desc_resources(priv);
 
 	return ret;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'
  2017-07-08  7:46   ` Christophe JAILLET
@ 2017-07-10  6:21     ` Giuseppe CAVALLARO
  -1 siblings, 0 replies; 16+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-10  6:21 UTC (permalink / raw)
  To: Christophe JAILLET, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors

On 7/8/2017 9:46 AM, Christophe JAILLET wrote:
> If the first 'kmalloc_array' within the loop fails, we should free what
> as already been allocated, as done in all other error handling path.
>
> Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 19bba6281dab..4322fa4a13e8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
>   						    sizeof(dma_addr_t),
>   						    GFP_KERNEL);
>   		if (!rx_q->rx_skbuff_dma)
> -			return -ENOMEM;
> +			goto err_dma;
>   
>   		rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
>   						sizeof(struct sk_buff *),

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'
@ 2017-07-10  6:21     ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 16+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-10  6:21 UTC (permalink / raw)
  To: Christophe JAILLET, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors

On 7/8/2017 9:46 AM, Christophe JAILLET wrote:
> If the first 'kmalloc_array' within the loop fails, we should free what
> as already been allocated, as done in all other error handling path.
>
> Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 19bba6281dab..4322fa4a13e8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
>   						    sizeof(dma_addr_t),
>   						    GFP_KERNEL);
>   		if (!rx_q->rx_skbuff_dma)
> -			return -ENOMEM;
> +			goto err_dma;
>   
>   		rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
>   						sizeof(struct sk_buff *),



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()'
  2017-07-08  7:46   ` Christophe JAILLET
@ 2017-07-10  6:22     ` Giuseppe CAVALLARO
  -1 siblings, 0 replies; 16+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-10  6:22 UTC (permalink / raw)
  To: Christophe JAILLET, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors

On 7/8/2017 9:46 AM, Christophe JAILLET wrote:
> If the first 'kmalloc_array' within the loop fails, we should free what
> as already been allocated, as done in all other error handling path.
>
> Fixes: ce736788e8a9 ("net: stmmac: adding multiple buffers for TX")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 4322fa4a13e8..07d486a70118 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1561,7 +1561,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   						    sizeof(*tx_q->tx_skbuff_dma),
>   						    GFP_KERNEL);
>   		if (!tx_q->tx_skbuff_dma)
> -			return -ENOMEM;
> +			goto err_dma_buffers;
>   
>   		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
>   						sizeof(struct sk_buff *),

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()'
@ 2017-07-10  6:22     ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 16+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-10  6:22 UTC (permalink / raw)
  To: Christophe JAILLET, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors

On 7/8/2017 9:46 AM, Christophe JAILLET wrote:
> If the first 'kmalloc_array' within the loop fails, we should free what
> as already been allocated, as done in all other error handling path.
>
> Fixes: ce736788e8a9 ("net: stmmac: adding multiple buffers for TX")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 4322fa4a13e8..07d486a70118 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1561,7 +1561,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   						    sizeof(*tx_q->tx_skbuff_dma),
>   						    GFP_KERNEL);
>   		if (!tx_q->tx_skbuff_dma)
> -			return -ENOMEM;
> +			goto err_dma_buffers;
>   
>   		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
>   						sizeof(struct sk_buff *),



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer
  2017-07-08  7:46   ` Christophe JAILLET
@ 2017-07-10  6:22     ` Giuseppe CAVALLARO
  -1 siblings, 0 replies; 16+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-10  6:22 UTC (permalink / raw)
  To: Christophe JAILLET, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors

On 7/8/2017 9:46 AM, Christophe JAILLET wrote:
> 'alloc_dma_[rt]x_desc_resources()' functions look very close.
> Remove a useless initialization and use the same label name for error
> handling path in order to get them even closer.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 07d486a70118..1853f7ff6657 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1449,7 +1449,7 @@ static void free_dma_rx_desc_resources(struct stmmac_priv *priv)
>   static void free_dma_tx_desc_resources(struct stmmac_priv *priv)
>   {
>   	u32 tx_count = priv->plat->tx_queues_to_use;
> -	u32 queue = 0;
> +	u32 queue;
>   
>   	/* Free TX queue resources */
>   	for (queue = 0; queue < tx_count; queue++) {
> @@ -1561,13 +1561,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   						    sizeof(*tx_q->tx_skbuff_dma),
>   						    GFP_KERNEL);
>   		if (!tx_q->tx_skbuff_dma)
> -			goto err_dma_buffers;
> +			goto err_dma;
>   
>   		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
>   						sizeof(struct sk_buff *),
>   						GFP_KERNEL);
>   		if (!tx_q->tx_skbuff)
> -			goto err_dma_buffers;
> +			goto err_dma;
>   
>   		if (priv->extend_desc) {
>   			tx_q->dma_etx = dma_zalloc_coherent(priv->device,
> @@ -1577,7 +1577,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   							    &tx_q->dma_tx_phy,
>   							    GFP_KERNEL);
>   			if (!tx_q->dma_etx)
> -				goto err_dma_buffers;
> +				goto err_dma;
>   		} else {
>   			tx_q->dma_tx = dma_zalloc_coherent(priv->device,
>   							   DMA_TX_SIZE *
> @@ -1586,13 +1586,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   							   &tx_q->dma_tx_phy,
>   							   GFP_KERNEL);
>   			if (!tx_q->dma_tx)
> -				goto err_dma_buffers;
> +				goto err_dma;
>   		}
>   	}
>   
>   	return 0;
>   
> -err_dma_buffers:
> +err_dma:
>   	free_dma_tx_desc_resources(priv);
>   
>   	return ret;

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer
@ 2017-07-10  6:22     ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 16+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-10  6:22 UTC (permalink / raw)
  To: Christophe JAILLET, alexandre.torgue
  Cc: netdev, linux-kernel, kernel-janitors

On 7/8/2017 9:46 AM, Christophe JAILLET wrote:
> 'alloc_dma_[rt]x_desc_resources()' functions look very close.
> Remove a useless initialization and use the same label name for error
> handling path in order to get them even closer.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 07d486a70118..1853f7ff6657 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1449,7 +1449,7 @@ static void free_dma_rx_desc_resources(struct stmmac_priv *priv)
>   static void free_dma_tx_desc_resources(struct stmmac_priv *priv)
>   {
>   	u32 tx_count = priv->plat->tx_queues_to_use;
> -	u32 queue = 0;
> +	u32 queue;
>   
>   	/* Free TX queue resources */
>   	for (queue = 0; queue < tx_count; queue++) {
> @@ -1561,13 +1561,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   						    sizeof(*tx_q->tx_skbuff_dma),
>   						    GFP_KERNEL);
>   		if (!tx_q->tx_skbuff_dma)
> -			goto err_dma_buffers;
> +			goto err_dma;
>   
>   		tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
>   						sizeof(struct sk_buff *),
>   						GFP_KERNEL);
>   		if (!tx_q->tx_skbuff)
> -			goto err_dma_buffers;
> +			goto err_dma;
>   
>   		if (priv->extend_desc) {
>   			tx_q->dma_etx = dma_zalloc_coherent(priv->device,
> @@ -1577,7 +1577,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   							    &tx_q->dma_tx_phy,
>   							    GFP_KERNEL);
>   			if (!tx_q->dma_etx)
> -				goto err_dma_buffers;
> +				goto err_dma;
>   		} else {
>   			tx_q->dma_tx = dma_zalloc_coherent(priv->device,
>   							   DMA_TX_SIZE *
> @@ -1586,13 +1586,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
>   							   &tx_q->dma_tx_phy,
>   							   GFP_KERNEL);
>   			if (!tx_q->dma_tx)
> -				goto err_dma_buffers;
> +				goto err_dma;
>   		}
>   	}
>   
>   	return 0;
>   
> -err_dma_buffers:
> +err_dma:
>   	free_dma_tx_desc_resources(priv);
>   
>   	return ret;



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()'
  2017-07-08  7:46 ` Christophe JAILLET
@ 2017-07-11 20:34   ` David Miller
  -1 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2017-07-11 20:34 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel, kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat,  8 Jul 2017 09:46:12 +0200

> These patchs are all related to 'alloc_dma_[rt]x_desc_resources()' functions.
> 
> The 2 first fix an error path where some resources are leaking. I've
> separated them into 2 patches because the issues have been introduced by
> 2 deferent commits.
> 
> The 3rd patch is just a clean-up.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()'
@ 2017-07-11 20:34   ` David Miller
  0 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2017-07-11 20:34 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel, kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat,  8 Jul 2017 09:46:12 +0200

> These patchs are all related to 'alloc_dma_[rt]x_desc_resources()' functions.
> 
> The 2 first fix an error path where some resources are leaking. I've
> separated them into 2 patches because the issues have been introduced by
> 2 deferent commits.
> 
> The 3rd patch is just a clean-up.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-07-11 20:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08  7:46 [PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()' Christophe JAILLET
2017-07-08  7:46 ` Christophe JAILLET
2017-07-08  7:46 ` [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()' Christophe JAILLET
2017-07-08  7:46   ` Christophe JAILLET
2017-07-10  6:21   ` Giuseppe CAVALLARO
2017-07-10  6:21     ` Giuseppe CAVALLARO
2017-07-08  7:46 ` [PATCH 2/3] net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()' Christophe JAILLET
2017-07-08  7:46   ` Christophe JAILLET
2017-07-10  6:22   ` Giuseppe CAVALLARO
2017-07-10  6:22     ` Giuseppe CAVALLARO
2017-07-08  7:46 ` [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer Christophe JAILLET
2017-07-08  7:46   ` Christophe JAILLET
2017-07-10  6:22   ` Giuseppe CAVALLARO
2017-07-10  6:22     ` Giuseppe CAVALLARO
2017-07-11 20:34 ` [PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()' David Miller
2017-07-11 20:34   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.