[PATCH] net: ethernet: fix call_kern.cocci warnings

Julia Lawall julia.lawall at lip6.fr
Sat Dec 16 22:43:10 PST 2017


From: Fengguang Wu <fengguang.wu at intel.com>

Allocation with GFP_KERNEL in code called from the function
geth_resize_freeq with locks held.

Generated by: scripts/coccinelle/locks/call_kern.cocci

Fixes: 502a2864e5e4 ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
Signed-off-by: Julia Lawall <julia.lawall at lip6.fr>
---

 The proposed change of converting the GFP_KERNEL is not necessarily the
 correct one.  It may be desired to unlock the lock, or to not call the
 function under the lock in the first place.

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
gemini-ethernet
head:   502a2864e5e43c51a3a2689586d9c61d060a3b7d
commit: 502a2864e5e43c51a3a2689586d9c61d060a3b7d [18/18] net: ethernet:
Add a driver for Gemini gigabit ethernet

 gemini.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -818,7 +818,7 @@ static int geth_setup_freeq(struct gemin

 	geth->freeq_ring = dma_alloc_coherent(geth->dev,
 		sizeof(*geth->freeq_ring) << geth->freeq_order,
-		&geth->freeq_dma_base, GFP_KERNEL);
+		&geth->freeq_dma_base, GFP_ATOMIC);
 	if (!geth->freeq_ring)
 		return -ENOMEM;
 	if (geth->freeq_dma_base & ~DMA_Q_BASE_MASK) {
@@ -827,7 +827,7 @@ static int geth_setup_freeq(struct gemin
 	}

 	geth->freeq_page_tab = kzalloc(pages * sizeof(*geth->freeq_page_tab),
-				       GFP_KERNEL);
+				       GFP_ATOMIC);
 	if (!geth->freeq_page_tab)
 		goto err_freeq;




More information about the linux-arm-kernel mailing list