mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
can: grcan: 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 this driver 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> Link: https://lore.kernel.org/r/20230512212725.143824-9-u.kleine-koenig@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
55216590c9
commit
6aa62362f1
@ -1696,7 +1696,7 @@ exit_error:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int grcan_remove(struct platform_device *ofdev)
|
||||
static void grcan_remove(struct platform_device *ofdev)
|
||||
{
|
||||
struct net_device *dev = platform_get_drvdata(ofdev);
|
||||
struct grcan_priv *priv = netdev_priv(dev);
|
||||
@ -1706,8 +1706,6 @@ static int grcan_remove(struct platform_device *ofdev)
|
||||
irq_dispose_mapping(dev->irq);
|
||||
netif_napi_del(&priv->napi);
|
||||
free_candev(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id grcan_match[] = {
|
||||
@ -1726,7 +1724,7 @@ static struct platform_driver grcan_driver = {
|
||||
.of_match_table = grcan_match,
|
||||
},
|
||||
.probe = grcan_probe,
|
||||
.remove = grcan_remove,
|
||||
.remove_new = grcan_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(grcan_driver);
|
||||
|
Loading…
Reference in New Issue
Block a user