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

net: wan: fsl_qmc_hdlc: 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>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20240409091203.39062-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Uwe Kleine-König and committed by
Jakub Kicinski
07409cf7 4ede4575

+2 -4
+2 -4
drivers/net/wan/fsl_qmc_hdlc.c
··· 765 765 return ret; 766 766 } 767 767 768 - static int qmc_hdlc_remove(struct platform_device *pdev) 768 + static void qmc_hdlc_remove(struct platform_device *pdev) 769 769 { 770 770 struct qmc_hdlc *qmc_hdlc = platform_get_drvdata(pdev); 771 771 772 772 unregister_hdlc_device(qmc_hdlc->netdev); 773 773 free_netdev(qmc_hdlc->netdev); 774 774 qmc_hdlc_framer_exit(qmc_hdlc); 775 - 776 - return 0; 777 775 } 778 776 779 777 static const struct of_device_id qmc_hdlc_id_table[] = { ··· 786 788 .of_match_table = qmc_hdlc_id_table, 787 789 }, 788 790 .probe = qmc_hdlc_probe, 789 - .remove = qmc_hdlc_remove, 791 + .remove_new = qmc_hdlc_remove, 790 792 }; 791 793 module_platform_driver(qmc_hdlc_driver); 792 794