Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: trigger: iio-trig-interrupt: 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/20230919174931.1417681-49-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Uwe Kleine-König and committed by
Jonathan Cameron
548eb81d f5589173

+2 -4
+2 -4
drivers/iio/trigger/iio-trig-interrupt.c
··· 81 81 return ret; 82 82 } 83 83 84 - static int iio_interrupt_trigger_remove(struct platform_device *pdev) 84 + static void iio_interrupt_trigger_remove(struct platform_device *pdev) 85 85 { 86 86 struct iio_trigger *trig; 87 87 struct iio_interrupt_trigger_info *trig_info; ··· 92 92 free_irq(trig_info->irq, trig); 93 93 kfree(trig_info); 94 94 iio_trigger_free(trig); 95 - 96 - return 0; 97 95 } 98 96 99 97 static struct platform_driver iio_interrupt_trigger_driver = { 100 98 .probe = iio_interrupt_trigger_probe, 101 - .remove = iio_interrupt_trigger_remove, 99 + .remove_new = iio_interrupt_trigger_remove, 102 100 .driver = { 103 101 .name = "iio_interrupt_trigger", 104 102 },