* [PATCH] phy: xilinx: Convert to platform remove callback returning void
@ 2024-03-08 8:51 Uwe Kleine-König
2024-03-08 9:01 ` Michal Simek
2024-04-05 17:09 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2024-03-08 8:51 UTC (permalink / raw)
To: Laurent Pinchart, Vinod Koul, Kishon Vijay Abraham I,
Michal Simek
Cc: linux-kernel, linux-phy, linux-arm-kernel, kernel
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>
---
drivers/phy/xilinx/phy-zynqmp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index f72c5257d712..dc8319bda43d 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -995,15 +995,13 @@ static int xpsgtr_probe(struct platform_device *pdev)
return 0;
}
-static int xpsgtr_remove(struct platform_device *pdev)
+static void xpsgtr_remove(struct platform_device *pdev)
{
struct xpsgtr_dev *gtr_dev = platform_get_drvdata(pdev);
pm_runtime_disable(gtr_dev->dev);
pm_runtime_put_noidle(gtr_dev->dev);
pm_runtime_set_suspended(gtr_dev->dev);
-
- return 0;
}
static const struct of_device_id xpsgtr_of_match[] = {
@@ -1015,7 +1013,7 @@ MODULE_DEVICE_TABLE(of, xpsgtr_of_match);
static struct platform_driver xpsgtr_driver = {
.probe = xpsgtr_probe,
- .remove = xpsgtr_remove,
+ .remove_new = xpsgtr_remove,
.driver = {
.name = "xilinx-psgtr",
.of_match_table = xpsgtr_of_match,
base-commit: 8ffc8b1bbd505e27e2c8439d326b6059c906c9dd
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] phy: xilinx: Convert to platform remove callback returning void
2024-03-08 8:51 [PATCH] phy: xilinx: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-03-08 9:01 ` Michal Simek
2024-04-05 17:09 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2024-03-08 9:01 UTC (permalink / raw)
To: Uwe Kleine-König, Laurent Pinchart, Vinod Koul,
Kishon Vijay Abraham I
Cc: linux-kernel, linux-phy, linux-arm-kernel, kernel
On 3/8/24 09:51, 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().
>
> 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>
> ---
> drivers/phy/xilinx/phy-zynqmp.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
> index f72c5257d712..dc8319bda43d 100644
> --- a/drivers/phy/xilinx/phy-zynqmp.c
> +++ b/drivers/phy/xilinx/phy-zynqmp.c
> @@ -995,15 +995,13 @@ static int xpsgtr_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int xpsgtr_remove(struct platform_device *pdev)
> +static void xpsgtr_remove(struct platform_device *pdev)
> {
> struct xpsgtr_dev *gtr_dev = platform_get_drvdata(pdev);
>
> pm_runtime_disable(gtr_dev->dev);
> pm_runtime_put_noidle(gtr_dev->dev);
> pm_runtime_set_suspended(gtr_dev->dev);
> -
> - return 0;
> }
>
> static const struct of_device_id xpsgtr_of_match[] = {
> @@ -1015,7 +1013,7 @@ MODULE_DEVICE_TABLE(of, xpsgtr_of_match);
>
> static struct platform_driver xpsgtr_driver = {
> .probe = xpsgtr_probe,
> - .remove = xpsgtr_remove,
> + .remove_new = xpsgtr_remove,
> .driver = {
> .name = "xilinx-psgtr",
> .of_match_table = xpsgtr_of_match,
>
> base-commit: 8ffc8b1bbd505e27e2c8439d326b6059c906c9dd
Acked-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] phy: xilinx: Convert to platform remove callback returning void
2024-03-08 8:51 [PATCH] phy: xilinx: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-08 9:01 ` Michal Simek
@ 2024-04-05 17:09 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2024-04-05 17:09 UTC (permalink / raw)
To: Laurent Pinchart, Kishon Vijay Abraham I, Michal Simek,
Uwe Kleine-König
Cc: linux-kernel, linux-phy, linux-arm-kernel, kernel
On Fri, 08 Mar 2024 09:51:13 +0100, 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: xilinx: Convert to platform remove callback returning void
commit: 7dcb8668aedc5603cba1f2625c6051beff03797d
Best regards,
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-05 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08 8:51 [PATCH] phy: xilinx: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-08 9:01 ` Michal Simek
2024-04-05 17:09 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox