Skip to content

Commit

Permalink
net: hix5hd2_gmac: Remove unneeded cast from memory allocation
Browse files Browse the repository at this point in the history
Remove casting the values returned by memory allocation function.

Coccinelle emits WARNING:

./drivers/net/ethernet/hisilicon/hix5hd2_gmac.c:1027:9-23: WARNING:
 casting value returned by memory allocation function to (struct sg_desc *) is useless.

This issue was detected by using the Coccinelle software.

Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wang Hai authored and David S. Miller committed Jul 25, 2020
1 parent a8cf7d0 commit 9b964f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,9 +1024,9 @@ static int hix5hd2_init_sg_desc_queue(struct hix5hd2_priv *priv)
struct sg_desc *desc;
dma_addr_t phys_addr;

desc = (struct sg_desc *)dma_alloc_coherent(priv->dev,
TX_DESC_NUM * sizeof(struct sg_desc),
&phys_addr, GFP_KERNEL);
desc = dma_alloc_coherent(priv->dev,
TX_DESC_NUM * sizeof(struct sg_desc),
&phys_addr, GFP_KERNEL);
if (!desc)
return -ENOMEM;

Expand Down

0 comments on commit 9b964f1

Please sign in to comment.