linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: seeq: Fix the function used to release some memory in an error handling path
@ 2019-08-31  7:17 Christophe JAILLET
  2019-08-31  8:19 ` Thomas Bogendoerfer
  2019-09-01 19:11 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2019-08-31  7:17 UTC (permalink / raw)
  To: davem, yuehaibing, tglx, gregkh, tbogendoerfer
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

In commit 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv"),
a call to 'get_zeroed_page()' has been turned into a call to
'dma_alloc_coherent()'. Only the remove function has been updated to turn
the corresponding 'free_page()' into 'dma_free_attrs()'.
The error hndling path of the probe function has not been updated.

Fix it now.

Rename the corresponding label to something more in line.

Fixes: 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
If 'dma_alloc_coherent()' fails, maybe the message in printk could be
improved. The comment above may also not be relevant.
---
 drivers/net/ethernet/seeq/sgiseeq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c
index 7a5e6c5abb57..276c7cae7cee 100644
--- a/drivers/net/ethernet/seeq/sgiseeq.c
+++ b/drivers/net/ethernet/seeq/sgiseeq.c
@@ -794,15 +794,16 @@ static int sgiseeq_probe(struct platform_device *pdev)
 		printk(KERN_ERR "Sgiseeq: Cannot register net device, "
 		       "aborting.\n");
 		err = -ENODEV;
-		goto err_out_free_page;
+		goto err_out_free_attrs;
 	}
 
 	printk(KERN_INFO "%s: %s %pM\n", dev->name, sgiseeqstr, dev->dev_addr);
 
 	return 0;
 
-err_out_free_page:
-	free_page((unsigned long) sp->srings);
+err_out_free_attrs:
+	dma_free_attrs(&pdev->dev, sizeof(*sp->srings), sp->srings,
+		       sp->srings_dma, DMA_ATTR_NON_CONSISTENT);
 err_out_free_dev:
 	free_netdev(dev);
 
-- 
2.20.1


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

* Re: [PATCH] net: seeq: Fix the function used to release some memory in an error handling path
  2019-08-31  7:17 [PATCH] net: seeq: Fix the function used to release some memory in an error handling path Christophe JAILLET
@ 2019-08-31  8:19 ` Thomas Bogendoerfer
  2019-09-01 19:11 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2019-08-31  8:19 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: davem, yuehaibing, tglx, gregkh, netdev, linux-kernel, kernel-janitors

On Sat, 31 Aug 2019 09:17:51 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> In commit 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv"),
> a call to 'get_zeroed_page()' has been turned into a call to
> 'dma_alloc_coherent()'. Only the remove function has been updated to turn
> the corresponding 'free_page()' into 'dma_free_attrs()'.
> The error hndling path of the probe function has not been updated.

Looks good.

Reviewed-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>

Thomas.

-- 
SUSE Software Solutions Germany GmbH
HRB 247165 (AG München)
Geschäftsführer: Felix Imendörffer

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

* Re: [PATCH] net: seeq: Fix the function used to release some memory in an error handling path
  2019-08-31  7:17 [PATCH] net: seeq: Fix the function used to release some memory in an error handling path Christophe JAILLET
  2019-08-31  8:19 ` Thomas Bogendoerfer
@ 2019-09-01 19:11 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-09-01 19:11 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: yuehaibing, tglx, gregkh, tbogendoerfer, netdev, linux-kernel,
	kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat, 31 Aug 2019 09:17:51 +0200

> In commit 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv"),
> a call to 'get_zeroed_page()' has been turned into a call to
> 'dma_alloc_coherent()'. Only the remove function has been updated to turn
> the corresponding 'free_page()' into 'dma_free_attrs()'.
> The error hndling path of the probe function has not been updated.
> 
> Fix it now.
> 
> Rename the corresponding label to something more in line.
> 
> Fixes: 99cd149efe82 ("sgiseeq: replace use of dma_cache_wback_inv")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied.

> If 'dma_alloc_coherent()' fails, maybe the message in printk could be
> improved. The comment above may also not be relevant.

Memory allocation failures already give a stack backtrack down deep in the
memory allocators, therefore printing messages at allocation call sites
are veboten.

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

end of thread, other threads:[~2019-09-01 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31  7:17 [PATCH] net: seeq: Fix the function used to release some memory in an error handling path Christophe JAILLET
2019-08-31  8:19 ` Thomas Bogendoerfer
2019-09-01 19:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).