Skip to content

Commit

Permalink
net: stmicro: replace kzalloc with devm_kzalloc
Browse files Browse the repository at this point in the history
The axi variable was not being freed upon device removal.
With devm_kzalloc it ensures that it is properly freed.

Signed-off-by: Joao Pinto <jpinto@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Joao Pinto authored and David S. Miller committed Mar 9, 2017
1 parent e3c36e4 commit 64f48e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
if (!np)
return NULL;

axi = kzalloc(sizeof(*axi), GFP_KERNEL);
axi = devm_kzalloc(&pdev->dev, sizeof(*axi), GFP_KERNEL);
if (!axi) {
of_node_put(np);
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit 64f48e5

Please sign in to comment.