Skip to content

Commit 391d0ad

Browse files
Wang Haigregkh
authored andcommitted
net: gemini: Fix missing free_netdev() in error path of gemini_ethernet_port_probe()
[ Upstream commit cf96d97 ] Replace alloc_etherdev_mq with devm_alloc_etherdev_mqs. In this way, when probe fails, netdev can be freed automatically. Fixes: 4d5ae32 ("net: ethernet: Add a driver for Gemini gigabit ethernet") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wang Hai <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 676f44c commit 391d0ad

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/net/ethernet/cortina/gemini.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
23922392

23932393
dev_info(dev, "probe %s ID %d\n", dev_name(dev), id);
23942394

2395-
netdev = alloc_etherdev_mq(sizeof(*port), TX_QUEUE_NUM);
2395+
netdev = devm_alloc_etherdev_mqs(dev, sizeof(*port), TX_QUEUE_NUM, TX_QUEUE_NUM);
23962396
if (!netdev) {
23972397
dev_err(dev, "Can't allocate ethernet device #%d\n", id);
23982398
return -ENOMEM;
@@ -2526,7 +2526,6 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
25262526
}
25272527

25282528
port->netdev = NULL;
2529-
free_netdev(netdev);
25302529
return ret;
25312530
}
25322531

@@ -2535,7 +2534,6 @@ static int gemini_ethernet_port_remove(struct platform_device *pdev)
25352534
struct gemini_ethernet_port *port = platform_get_drvdata(pdev);
25362535

25372536
gemini_port_remove(port);
2538-
free_netdev(port->netdev);
25392537
return 0;
25402538
}
25412539

0 commit comments

Comments
 (0)