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

Configure Feed

Select the types of activity you want to include in your feed.

slimbus: 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 the slimbus drivers 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>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240430091657.35428-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
880b33b0 4286dbce

+6 -10
+2 -3
drivers/slimbus/qcom-ctrl.c
··· 626 626 return ret; 627 627 } 628 628 629 - static int qcom_slim_remove(struct platform_device *pdev) 629 + static void qcom_slim_remove(struct platform_device *pdev) 630 630 { 631 631 struct qcom_slim_ctrl *ctrl = platform_get_drvdata(pdev); 632 632 ··· 635 635 clk_disable_unprepare(ctrl->rclk); 636 636 clk_disable_unprepare(ctrl->hclk); 637 637 destroy_workqueue(ctrl->rxwq); 638 - return 0; 639 638 } 640 639 641 640 /* ··· 720 721 721 722 static struct platform_driver qcom_slim_driver = { 722 723 .probe = qcom_slim_probe, 723 - .remove = qcom_slim_remove, 724 + .remove_new = qcom_slim_remove, 724 725 .driver = { 725 726 .name = "qcom_slim_ctrl", 726 727 .of_match_table = qcom_slim_dt_match,
+4 -7
drivers/slimbus/qcom-ngd-ctrl.c
··· 1674 1674 return ret; 1675 1675 } 1676 1676 1677 - static int qcom_slim_ngd_ctrl_remove(struct platform_device *pdev) 1677 + static void qcom_slim_ngd_ctrl_remove(struct platform_device *pdev) 1678 1678 { 1679 1679 platform_driver_unregister(&qcom_slim_ngd_driver); 1680 - 1681 - return 0; 1682 1680 } 1683 1681 1684 - static int qcom_slim_ngd_remove(struct platform_device *pdev) 1682 + static void qcom_slim_ngd_remove(struct platform_device *pdev) 1685 1683 { 1686 1684 struct qcom_slim_ngd_ctrl *ctrl = platform_get_drvdata(pdev); 1687 1685 ··· 1694 1696 1695 1697 kfree(ctrl->ngd); 1696 1698 ctrl->ngd = NULL; 1697 - return 0; 1698 1699 } 1699 1700 1700 1701 static int __maybe_unused qcom_slim_ngd_runtime_idle(struct device *dev) ··· 1736 1739 1737 1740 static struct platform_driver qcom_slim_ngd_ctrl_driver = { 1738 1741 .probe = qcom_slim_ngd_ctrl_probe, 1739 - .remove = qcom_slim_ngd_ctrl_remove, 1742 + .remove_new = qcom_slim_ngd_ctrl_remove, 1740 1743 .driver = { 1741 1744 .name = "qcom,slim-ngd-ctrl", 1742 1745 .of_match_table = qcom_slim_ngd_dt_match, ··· 1745 1748 1746 1749 static struct platform_driver qcom_slim_ngd_driver = { 1747 1750 .probe = qcom_slim_ngd_probe, 1748 - .remove = qcom_slim_ngd_remove, 1751 + .remove_new = qcom_slim_ngd_remove, 1749 1752 .driver = { 1750 1753 .name = QCOM_SLIM_NGD_DRV_NAME, 1751 1754 .pm = &qcom_slim_ngd_dev_pm_ops,