mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
net: ethernet: renesas: 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> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5180236592
commit
0b4f04e2f6
@ -2878,7 +2878,7 @@ out_release:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ravb_remove(struct platform_device *pdev)
|
static void ravb_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||||
struct ravb_private *priv = netdev_priv(ndev);
|
struct ravb_private *priv = netdev_priv(ndev);
|
||||||
@ -2905,8 +2905,6 @@ static int ravb_remove(struct platform_device *pdev)
|
|||||||
reset_control_assert(priv->rstc);
|
reset_control_assert(priv->rstc);
|
||||||
free_netdev(ndev);
|
free_netdev(ndev);
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ravb_wol_setup(struct net_device *ndev)
|
static int ravb_wol_setup(struct net_device *ndev)
|
||||||
@ -3044,7 +3042,7 @@ static const struct dev_pm_ops ravb_dev_pm_ops = {
|
|||||||
|
|
||||||
static struct platform_driver ravb_driver = {
|
static struct platform_driver ravb_driver = {
|
||||||
.probe = ravb_probe,
|
.probe = ravb_probe,
|
||||||
.remove = ravb_remove,
|
.remove_new = ravb_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "ravb",
|
.name = "ravb",
|
||||||
.pm = &ravb_dev_pm_ops,
|
.pm = &ravb_dev_pm_ops,
|
||||||
|
@ -1968,7 +1968,7 @@ static void rswitch_deinit(struct rswitch_private *priv)
|
|||||||
rswitch_clock_disable(priv);
|
rswitch_clock_disable(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int renesas_eth_sw_remove(struct platform_device *pdev)
|
static void renesas_eth_sw_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct rswitch_private *priv = platform_get_drvdata(pdev);
|
struct rswitch_private *priv = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
@ -1978,13 +1978,11 @@ static int renesas_eth_sw_remove(struct platform_device *pdev)
|
|||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver renesas_eth_sw_driver_platform = {
|
static struct platform_driver renesas_eth_sw_driver_platform = {
|
||||||
.probe = renesas_eth_sw_probe,
|
.probe = renesas_eth_sw_probe,
|
||||||
.remove = renesas_eth_sw_remove,
|
.remove_new = renesas_eth_sw_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "renesas_eth_sw",
|
.name = "renesas_eth_sw",
|
||||||
.of_match_table = renesas_eth_sw_of_table,
|
.of_match_table = renesas_eth_sw_of_table,
|
||||||
|
@ -3431,7 +3431,7 @@ out_release:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sh_eth_drv_remove(struct platform_device *pdev)
|
static void sh_eth_drv_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||||
struct sh_eth_private *mdp = netdev_priv(ndev);
|
struct sh_eth_private *mdp = netdev_priv(ndev);
|
||||||
@ -3441,8 +3441,6 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
|
|||||||
sh_mdio_release(mdp);
|
sh_mdio_release(mdp);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
free_netdev(ndev);
|
free_netdev(ndev);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
@ -3562,7 +3560,7 @@ MODULE_DEVICE_TABLE(platform, sh_eth_id_table);
|
|||||||
|
|
||||||
static struct platform_driver sh_eth_driver = {
|
static struct platform_driver sh_eth_driver = {
|
||||||
.probe = sh_eth_drv_probe,
|
.probe = sh_eth_drv_probe,
|
||||||
.remove = sh_eth_drv_remove,
|
.remove_new = sh_eth_drv_remove,
|
||||||
.id_table = sh_eth_id_table,
|
.id_table = sh_eth_id_table,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = CARDNAME,
|
.name = CARDNAME,
|
||||||
|
Loading…
Reference in New Issue
Block a user