mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
net: ethernet: smsc: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert these drivers from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
506a327cea
commit
e8e2c863f9
@ -2411,7 +2411,7 @@ static int smc_drv_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int smc_drv_remove(struct platform_device *pdev)
|
||||
static void smc_drv_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct smc_local *lp = netdev_priv(ndev);
|
||||
@ -2436,8 +2436,6 @@ static int smc_drv_remove(struct platform_device *pdev)
|
||||
release_mem_region(res->start, SMC_IO_EXTENT);
|
||||
|
||||
free_netdev(ndev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smc_drv_suspend(struct device *dev)
|
||||
@ -2480,7 +2478,7 @@ static const struct dev_pm_ops smc_drv_pm_ops = {
|
||||
|
||||
static struct platform_driver smc_driver = {
|
||||
.probe = smc_drv_probe,
|
||||
.remove = smc_drv_remove,
|
||||
.remove_new = smc_drv_remove,
|
||||
.driver = {
|
||||
.name = CARDNAME,
|
||||
.pm = &smc_drv_pm_ops,
|
||||
|
@ -2314,7 +2314,7 @@ static int smsc911x_init(struct net_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smsc911x_drv_remove(struct platform_device *pdev)
|
||||
static void smsc911x_drv_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *dev;
|
||||
struct smsc911x_data *pdata;
|
||||
@ -2348,8 +2348,6 @@ static int smsc911x_drv_remove(struct platform_device *pdev)
|
||||
free_netdev(dev);
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* standard register acces */
|
||||
@ -2668,7 +2666,7 @@ MODULE_DEVICE_TABLE(acpi, smsc911x_acpi_match);
|
||||
|
||||
static struct platform_driver smsc911x_driver = {
|
||||
.probe = smsc911x_drv_probe,
|
||||
.remove = smsc911x_drv_remove,
|
||||
.remove_new = smsc911x_drv_remove,
|
||||
.driver = {
|
||||
.name = SMSC_CHIPNAME,
|
||||
.pm = SMSC911X_PM_OPS,
|
||||
|
Loading…
Reference in New Issue
Block a user