mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
w1: w1-gpio: 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() will be 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/bd69ccde7395cf4bf63765e29c1ce83834d3669b.1708340114.git.u.kleine-koenig@pengutronix.de Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
parent
d7516044f1
commit
d97d263132
@ -141,7 +141,7 @@ static int w1_gpio_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int w1_gpio_remove(struct platform_device *pdev)
|
||||
static void w1_gpio_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct w1_bus_master *master = platform_get_drvdata(pdev);
|
||||
struct w1_gpio_ddata *ddata = master->data;
|
||||
@ -150,8 +150,6 @@ static int w1_gpio_remove(struct platform_device *pdev)
|
||||
gpiod_set_value(ddata->pullup_gpiod, 0);
|
||||
|
||||
w1_remove_master_device(master);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver w1_gpio_driver = {
|
||||
@ -160,7 +158,7 @@ static struct platform_driver w1_gpio_driver = {
|
||||
.of_match_table = of_match_ptr(w1_gpio_dt_ids),
|
||||
},
|
||||
.probe = w1_gpio_probe,
|
||||
.remove = w1_gpio_remove,
|
||||
.remove_new = w1_gpio_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(w1_gpio_driver);
|
||||
|
Loading…
Reference in New Issue
Block a user