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

fsi: occ: 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.

Link: https://lists.ozlabs.org/pipermail/linux-fsi/2024-March/000613.html
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+2 -4
+2 -4
drivers/fsi/fsi-occ.c
··· 703 703 return 0; 704 704 } 705 705 706 - static int occ_remove(struct platform_device *pdev) 706 + static void occ_remove(struct platform_device *pdev) 707 707 { 708 708 struct occ *occ = platform_get_drvdata(pdev); 709 709 ··· 720 720 device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child); 721 721 722 722 ida_simple_remove(&occ_ida, occ->idx); 723 - 724 - return 0; 725 723 } 726 724 727 725 static const struct of_device_id occ_match[] = { ··· 741 743 .of_match_table = occ_match, 742 744 }, 743 745 .probe = occ_probe, 744 - .remove = occ_remove, 746 + .remove_new = occ_remove, 745 747 }; 746 748 747 749 static int occ_init(void)