net: ftgmac100: Use devm_alloc_etherdev()

Make use of devm_alloc_etherdev() to simplify cleanup.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Link: https://patch.msgid.link/20260206-ftgmac-cleanup-v5-4-ad28a9067ea7@aspeedtech.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Andrew Lunn 2026-02-06 11:17:44 +08:00 committed by Paolo Abeni
parent 9b42f74808
commit f4bef838a4

View File

@ -1877,11 +1877,9 @@ static int ftgmac100_probe(struct platform_device *pdev)
return irq;
/* setup net_device */
netdev = alloc_etherdev(sizeof(*priv));
if (!netdev) {
err = -ENOMEM;
goto err_alloc_etherdev;
}
netdev = devm_alloc_etherdev(&pdev->dev, sizeof(*priv));
if (!netdev)
return -ENOMEM;
SET_NETDEV_DEV(netdev, &pdev->dev);
@ -2080,8 +2078,6 @@ static int ftgmac100_probe(struct platform_device *pdev)
err_ioremap:
release_resource(priv->res);
err_req_mem:
free_netdev(netdev);
err_alloc_etherdev:
return err;
}
@ -2112,7 +2108,6 @@ static void ftgmac100_remove(struct platform_device *pdev)
release_resource(priv->res);
netif_napi_del(&priv->napi);
free_netdev(netdev);
}
static const struct ftgmac100_match_data ftgmac100_match_data_ast2400 = {