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

spi: oc-tiny: 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 (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@pengutronix.de>
Link: https://lore.kernel.org/r/20230303172041.2103336-49-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Uwe Kleine-König and committed by
Mark Brown
bdffa602 2dd82e32

+2 -3
+2 -3
drivers/spi/spi-oc-tiny.c
··· 271 271 return err; 272 272 } 273 273 274 - static int tiny_spi_remove(struct platform_device *pdev) 274 + static void tiny_spi_remove(struct platform_device *pdev) 275 275 { 276 276 struct tiny_spi *hw = platform_get_drvdata(pdev); 277 277 struct spi_master *master = hw->bitbang.master; 278 278 279 279 spi_bitbang_stop(&hw->bitbang); 280 280 spi_master_put(master); 281 - return 0; 282 281 } 283 282 284 283 #ifdef CONFIG_OF ··· 290 291 291 292 static struct platform_driver tiny_spi_driver = { 292 293 .probe = tiny_spi_probe, 293 - .remove = tiny_spi_remove, 294 + .remove_new = tiny_spi_remove, 294 295 .driver = { 295 296 .name = DRV_NAME, 296 297 .pm = NULL,