diff mbox series

phy: freescale: fsl-samsung-hdmi: Convert to platform remove callback returning void

Message ID 20240409161505.66619-2-u.kleine-koenig@pengutronix.de
State Accepted
Commit c49de54c6224103ab9c4b98464b03ab82721839a
Headers show
Series phy: freescale: fsl-samsung-hdmi: Convert to platform remove callback returning void | expand

Commit Message

Uwe Kleine-König April 9, 2024, 4:15 p.m. UTC
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>
---
Hello,

the driver patched here doesn't exist yet in the main line, it currently
is added in commit 6ad082bee902 available in
git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git next .

Best regards
Uwe

 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)


base-commit: a053fd3ca5d1b927a8655f239c84b0d790218fda

Comments

Vinod Koul April 12, 2024, 11:36 a.m. UTC | #1
On Tue, 09 Apr 2024 18:15:06 +0200, Uwe Kleine-König wrote:
> 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().
> 
> [...]

Applied, thanks!

[1/1] phy: freescale: fsl-samsung-hdmi: Convert to platform remove callback returning void
      commit: c49de54c6224103ab9c4b98464b03ab82721839a

Best regards,
diff mbox series

Patch

diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
index 89e2c01f2ccf..9048cdc760c2 100644
--- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
+++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
@@ -657,11 +657,9 @@  static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int fsl_samsung_hdmi_phy_remove(struct platform_device *pdev)
+static void fsl_samsung_hdmi_phy_remove(struct platform_device *pdev)
 {
 	of_clk_del_provider(pdev->dev.of_node);
-
-	return 0;
 }
 
 static int __maybe_unused fsl_samsung_hdmi_phy_suspend(struct device *dev)
@@ -706,7 +704,7 @@  MODULE_DEVICE_TABLE(of, fsl_samsung_hdmi_phy_of_match);
 
 static struct platform_driver fsl_samsung_hdmi_phy_driver = {
 	.probe  = fsl_samsung_hdmi_phy_probe,
-	.remove = fsl_samsung_hdmi_phy_remove,
+	.remove_new = fsl_samsung_hdmi_phy_remove,
 	.driver = {
 		.name = "fsl-samsung-hdmi-phy",
 		.of_match_table = fsl_samsung_hdmi_phy_of_match,