mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
net: systemport: Fix memleak in bcm_sysport_probe
[ Upstream commit7ef1fc5730] When devm_kcalloc() fails, dev should be freed just like what we've done in the subsequent error paths. Fixes:7b78be48a8("net: systemport: Dynamically allocate number of TX rings") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
743f4a03d4
commit
c7d1a655c7
@@ -2441,8 +2441,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;
|
||||
|
||||
Reference in New Issue
Block a user