Skip to content

Commit c9cb135

Browse files
Russell King (Oracle)Paolo Abeni
authored andcommitted
net: stmmac: dwc-qos-eth: use devm_kzalloc() for AXI data
Everywhere else in the driver uses devm_kzalloc() when allocating the AXI data, so there is no kfree() of this structure. However, dwc-qos-eth uses kzalloc(), which leads to this memory being leaked. Switch to use devm_kzalloc(). Fixes: d825612 ("stmmac: adding new glue driver dwmac-dwc-qos-eth") Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent acf10a8 commit c9cb135

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
4646
u32 a_index = 0;
4747

4848
if (!plat_dat->axi) {
49-
plat_dat->axi = kzalloc(sizeof(struct stmmac_axi), GFP_KERNEL);
49+
plat_dat->axi = devm_kzalloc(&pdev->dev,
50+
sizeof(struct stmmac_axi),
51+
GFP_KERNEL);
5052

5153
if (!plat_dat->axi)
5254
return -ENOMEM;

0 commit comments

Comments
 (0)