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

spi: sh: 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-67-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Uwe Kleine-König and committed by
Mark Brown
dee2e255 80dc51da

+2 -4
+2 -4
drivers/spi/spi-sh.c
··· 377 377 return IRQ_HANDLED; 378 378 } 379 379 380 - static int spi_sh_remove(struct platform_device *pdev) 380 + static void spi_sh_remove(struct platform_device *pdev) 381 381 { 382 382 struct spi_sh_data *ss = platform_get_drvdata(pdev); 383 383 384 384 spi_unregister_master(ss->master); 385 385 free_irq(ss->irq, ss); 386 - 387 - return 0; 388 386 } 389 387 390 388 static int spi_sh_probe(struct platform_device *pdev) ··· 459 461 460 462 static struct platform_driver spi_sh_driver = { 461 463 .probe = spi_sh_probe, 462 - .remove = spi_sh_remove, 464 + .remove_new = spi_sh_remove, 463 465 .driver = { 464 466 .name = "sh_spi", 465 467 },