On Fri, Mar 03, 2023 at 10:37:16PM +0100, Uwe Kleine-König wrote: > 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 (mostly) ignored > 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. > > 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@xxxxxxxxxxxxxx> > --- > drivers/watchdog/wm8350_wdt.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c > index 33c62d51f00a..febda195aed2 100644 > --- a/drivers/watchdog/wm8350_wdt.c > +++ b/drivers/watchdog/wm8350_wdt.c > @@ -156,15 +156,14 @@ static int wm8350_wdt_probe(struct platform_device *pdev) > return watchdog_register_device(&wm8350_wdt); > } > > -static int wm8350_wdt_remove(struct platform_device *pdev) > +static void wm8350_wdt_remove(struct platform_device *pdev) > { > watchdog_unregister_device(&wm8350_wdt); > - return 0; > } Again, just call devm_watchdog_register_device() in the probe function and drop the remove function entirely. Thanks, Guenter > > static struct platform_driver wm8350_wdt_driver = { > .probe = wm8350_wdt_probe, > - .remove = wm8350_wdt_remove, > + .remove_new = wm8350_wdt_remove, > .driver = { > .name = "wm8350-wdt", > }, > -- > 2.39.1 >