* [PATCH 00/15] memory: Convert to platform remove callback returning void
@ 2023-12-17 14:29 Uwe Kleine-König
2023-12-17 14:29 ` [PATCH 08/15] memory: omap-gpmc: " Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-12-17 14:29 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: kernel, Markus Mayer, Broadcom internal kernel review list,
Florian Fainelli, linux-arm-kernel, linux-kernel,
Santosh Shilimkar, Paul Cercueil, linux-mips, Yong Wu,
Matthias Brugger, AngeloGioacchino Del Regno, linux-mediatek,
Roger Quadros, Tony Lindgren, linux-omap, Lukasz Luba,
Alim Akhtar, linux-pm, linux-samsung-soc, Maxime Coquelin,
Alexandre Torgue, linux-stm32, Thierry Reding, Jonathan Hunter,
Sumit Gupta, Nick Alcock, linux-tegra, Rob Herring
Hello,
this series converts the platform drivers below drivers/memory to make
use of .remove_new. See commit 5c5a7680e67b ("platform: Provide a remove
callback that returns no value") for an extended explanation and the
eventual goal. The TL;DR; is to make it harder for driver authors to
leak resources without noticing.
This is merge window material. All patches are pairwise independent of
each other so they can be applied individually. Still it would be great
to let them go in all together.
Best regards
Uwe
Uwe Kleine-König (15):
memory: brcmstb_dpfe: Convert to platform remove callback returning void
memory: brcmstb_memc: Convert to platform remove callback returning void
memory: emif: Convert to platform remove callback returning void
memory: fsl-corenet-cf: Convert to platform remove callback returning void
memory: fsl_ifc: Convert to platform remove callback returning void
memory: jz4780-nemc: Convert to platform remove callback returning void
memory: mtk-smi: Convert to platform remove callback returning void
memory: omap-gpmc: Convert to platform remove callback returning void
memory: renesas-rpc-if: Convert to platform remove callback returning void
memory: exynos5422-dmc: Convert to platform remove callback returning void
memory: stm32-fmc2-ebi: Convert to platform remove callback returning void
memory: tegra186-emc: Convert to platform remove callback returning void
memory: tegra210-emc: Convert to platform remove callback returning void
memory: ti-aemif: Convert to platform remove callback returning void
memory: ti-emif-pm: Convert to platform remove callback returning void
drivers/memory/brcmstb_dpfe.c | 6 ++----
drivers/memory/brcmstb_memc.c | 6 ++----
drivers/memory/emif.c | 6 ++----
drivers/memory/fsl-corenet-cf.c | 6 ++----
drivers/memory/fsl_ifc.c | 6 ++----
drivers/memory/jz4780-nemc.c | 5 ++---
drivers/memory/mtk-smi.c | 10 ++++------
drivers/memory/omap-gpmc.c | 6 ++----
drivers/memory/renesas-rpc-if.c | 6 ++----
drivers/memory/samsung/exynos5422-dmc.c | 6 ++----
drivers/memory/stm32-fmc2-ebi.c | 6 ++----
drivers/memory/tegra/tegra186-emc.c | 6 ++----
drivers/memory/tegra/tegra210-emc-core.c | 6 ++----
drivers/memory/ti-aemif.c | 5 ++---
drivers/memory/ti-emif-pm.c | 6 ++----
15 files changed, 32 insertions(+), 60 deletions(-)
base-commit: 17cb8a20bde66a520a2ca7aad1063e1ce7382240
--
2.42.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 08/15] memory: omap-gpmc: Convert to platform remove callback returning void
2023-12-17 14:29 [PATCH 00/15] memory: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-17 14:29 ` Uwe Kleine-König
2023-12-18 8:37 ` Tony Lindgren
2023-12-19 8:06 ` [PATCH 00/15] memory: " Krzysztof Kozlowski
2023-12-19 8:06 ` Krzysztof Kozlowski
2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2023-12-17 14:29 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: kernel, Roger Quadros, Tony Lindgren, linux-omap, linux-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/memory/omap-gpmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index d78f73db37c8..80d038884207 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2690,7 +2690,7 @@ static int gpmc_probe(struct platform_device *pdev)
return rc;
}
-static int gpmc_remove(struct platform_device *pdev)
+static void gpmc_remove(struct platform_device *pdev)
{
int i;
struct gpmc_device *gpmc = platform_get_drvdata(pdev);
@@ -2702,8 +2702,6 @@ static int gpmc_remove(struct platform_device *pdev)
gpmc_mem_exit();
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -2747,7 +2745,7 @@ MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
static struct platform_driver gpmc_driver = {
.probe = gpmc_probe,
- .remove = gpmc_remove,
+ .remove_new = gpmc_remove,
.driver = {
.name = DEVICE_NAME,
.of_match_table = of_match_ptr(gpmc_dt_ids),
--
2.42.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 08/15] memory: omap-gpmc: Convert to platform remove callback returning void
2023-12-17 14:29 ` [PATCH 08/15] memory: omap-gpmc: " Uwe Kleine-König
@ 2023-12-18 8:37 ` Tony Lindgren
0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2023-12-18 8:37 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Krzysztof Kozlowski, kernel, Roger Quadros, linux-omap,
linux-kernel
* Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [231217 14:30]:
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
Reviewed-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 00/15] memory: Convert to platform remove callback returning void
2023-12-17 14:29 [PATCH 00/15] memory: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-17 14:29 ` [PATCH 08/15] memory: omap-gpmc: " Uwe Kleine-König
@ 2023-12-19 8:06 ` Krzysztof Kozlowski
2023-12-19 8:06 ` Krzysztof Kozlowski
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2023-12-19 8:06 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Krzysztof Kozlowski, kernel, Markus Mayer,
Broadcom internal kernel review list, Florian Fainelli,
linux-arm-kernel, linux-kernel, Santosh Shilimkar, Paul Cercueil,
linux-mips, Yong Wu, Matthias Brugger, AngeloGioacchino Del Regno,
linux-mediatek, Roger Quadros, Tony Lindgren, linux-omap,
Lukasz Luba, Alim Akhtar, linux-pm, linux-samsung-soc,
Maxime Coquelin, Alexandre Torgue, linux-stm32, Thierry Reding,
Jonathan Hunter, Sumit Gupta, Nick Alcock, linux-tegra,
Rob Herring
On Sun, 17 Dec 2023 15:29:26 +0100, Uwe Kleine-König wrote:
> this series converts the platform drivers below drivers/memory to make
> use of .remove_new. See commit 5c5a7680e67b ("platform: Provide a remove
> callback that returns no value") for an extended explanation and the
> eventual goal. The TL;DR; is to make it harder for driver authors to
> leak resources without noticing.
>
> This is merge window material. All patches are pairwise independent of
> each other so they can be applied individually. Still it would be great
> to let them go in all together.
>
> [...]
Applied, thanks!
[01/15] memory: brcmstb_dpfe: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/431187eadbc7b0f2650d4e55111b3fff4720f867
[02/15] memory: brcmstb_memc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/f7754712ad6094de5be18674777b265ed4db2f45
[03/15] memory: emif: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/c8a53461990cb697ca494d6671fab9e196d20ce4
[04/15] memory: fsl-corenet-cf: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/021d044b0f9c9a09aa2f778e876e467a8810fb4a
[05/15] memory: fsl_ifc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/f17130855d51f24563a24cd957add769ad59eee9
[06/15] memory: jz4780-nemc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/9024fbbd77b4d73279bbbe2c748a4e4b414d50cc
[07/15] memory: mtk-smi: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/08c1aeaa45ce0fd18912e92c6705586c8aa5240f
[08/15] memory: omap-gpmc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/6a4edb1a4f61e28cc127cd06c470ce3599ee0d9c
[09/15] memory: renesas-rpc-if: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/961abc9f7d6771e8f13db1f4d8b0ffff3f0f41a4
[10/15] memory: exynos5422-dmc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/8013408e4912fb7e469bb8b14fd3a5c956257eec
[11/15] memory: stm32-fmc2-ebi: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/1455b6b0c83132960826d0e527a79a355e096a80
[12/15] memory: tegra186-emc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/dcefa0368458e9e20642dbd2608adae6b22e6464
[13/15] memory: tegra210-emc: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/622fa819a2f0f3e6d8322a0b6d3177302ae937b6
[14/15] memory: ti-aemif: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/7852eb8c8ac7e0164b43cc5f8d8245cc3a037620
[15/15] memory: ti-emif-pm: Convert to platform remove callback returning void
https://git.kernel.org/krzk/linux-mem-ctrl/c/365fcc03b6321f36eb7cbda8baa737238c387907
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 00/15] memory: Convert to platform remove callback returning void
2023-12-17 14:29 [PATCH 00/15] memory: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-17 14:29 ` [PATCH 08/15] memory: omap-gpmc: " Uwe Kleine-König
2023-12-19 8:06 ` [PATCH 00/15] memory: " Krzysztof Kozlowski
@ 2023-12-19 8:06 ` Krzysztof Kozlowski
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2023-12-19 8:06 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: kernel, Markus Mayer, Broadcom internal kernel review list,
Florian Fainelli, linux-arm-kernel, linux-kernel,
Santosh Shilimkar, Paul Cercueil, linux-mips, Yong Wu,
Matthias Brugger, AngeloGioacchino Del Regno, linux-mediatek,
Roger Quadros, Tony Lindgren, linux-omap, Lukasz Luba,
Alim Akhtar, linux-pm, linux-samsung-soc, Maxime Coquelin,
Alexandre Torgue, linux-stm32, Thierry Reding, Jonathan Hunter,
Sumit Gupta, Nick Alcock, linux-tegra, Rob Herring
On 17/12/2023 15:29, Uwe Kleine-König wrote:
> Hello,
>
> this series converts the platform drivers below drivers/memory to make
> use of .remove_new. See commit 5c5a7680e67b ("platform: Provide a remove
> callback that returns no value") for an extended explanation and the
> eventual goal. The TL;DR; is to make it harder for driver authors to
> leak resources without noticing.
Thanks, applied.
It is however very late in the cycle, so there is a chance this will
miss the merge window. If this happens, I will keep it for the next
cycle (no need for resending).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-19 8:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-17 14:29 [PATCH 00/15] memory: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-17 14:29 ` [PATCH 08/15] memory: omap-gpmc: " Uwe Kleine-König
2023-12-18 8:37 ` Tony Lindgren
2023-12-19 8:06 ` [PATCH 00/15] memory: " Krzysztof Kozlowski
2023-12-19 8:06 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).