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

pps: clients: 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.

Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Link: https://lore.kernel.org/r/f4b9402af72e5f285c8b0f068076a76418f653f5.1709886922.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+2 -3
+2 -3
drivers/pps/clients/pps-gpio.c
··· 220 220 return 0; 221 221 } 222 222 223 - static int pps_gpio_remove(struct platform_device *pdev) 223 + static void pps_gpio_remove(struct platform_device *pdev) 224 224 { 225 225 struct pps_gpio_device_data *data = platform_get_drvdata(pdev); 226 226 ··· 229 229 /* reset echo pin in any case */ 230 230 gpiod_set_value(data->echo_pin, 0); 231 231 dev_info(&pdev->dev, "removed IRQ %d as PPS source\n", data->irq); 232 - return 0; 233 232 } 234 233 235 234 static const struct of_device_id pps_gpio_dt_ids[] = { ··· 239 240 240 241 static struct platform_driver pps_gpio_driver = { 241 242 .probe = pps_gpio_probe, 242 - .remove = pps_gpio_remove, 243 + .remove_new = pps_gpio_remove, 243 244 .driver = { 244 245 .name = PPS_GPIO_NAME, 245 246 .of_match_table = pps_gpio_dt_ids,