Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: nvidia: forcedeth: Replace GFP_ATOMIC with GFP_KERNEL in nv_probe()

nv_probe() is never called in atomic context.
It calls dma_alloc_coherent() with GFP_ATOMIC, which is not necessary.
GFP_ATOMIC can be replaced with GFP_KERNEL.

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jia-Ju Bai and committed by
David S. Miller
6ae5cbc4 d818c59a

+2 -2
+2 -2
drivers/net/ethernet/nvidia/forcedeth.c
··· 5777 5777 (np->rx_ring_size + 5778 5778 np->tx_ring_size), 5779 5779 &np->ring_addr, 5780 - GFP_ATOMIC); 5780 + GFP_KERNEL); 5781 5781 if (!np->rx_ring.orig) 5782 5782 goto out_unmap; 5783 5783 np->tx_ring.orig = &np->rx_ring.orig[np->rx_ring_size]; ··· 5786 5786 sizeof(struct ring_desc_ex) * 5787 5787 (np->rx_ring_size + 5788 5788 np->tx_ring_size), 5789 - &np->ring_addr, GFP_ATOMIC); 5789 + &np->ring_addr, GFP_KERNEL); 5790 5790 if (!np->rx_ring.ex) 5791 5791 goto out_unmap; 5792 5792 np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size];