Commit 7ef1fc57 authored by Dinghao Liu's avatar Dinghao Liu Committed by David S. Miller

net: systemport: Fix memleak in bcm_sysport_probe

When devm_kcalloc() fails, dev should be freed just
like what we've done in the subsequent error paths.

Fixes: 7b78be48 ("net: systemport: Dynamically allocate number of TX rings")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 100e3345
......@@ -2491,8 +2491,10 @@ static int bcm_sysport_probe(struct platform_device *pdev)
priv->tx_rings = devm_kcalloc(&pdev->dev, txq,
sizeof(struct bcm_sysport_tx_ring),
GFP_KERNEL);
if (!priv->tx_rings)
return -ENOMEM;
if (!priv->tx_rings) {
ret = -ENOMEM;
goto err_free_netdev;
}
priv->is_lite = params->is_lite;
priv->num_rx_desc_words = params->num_rx_desc_words;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment