* [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 07/15] memory: mtk-smi: " Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 4+ 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] 4+ messages in thread
* [PATCH 07/15] memory: mtk-smi: 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-19 8:06 ` [PATCH 00/15] memory: " Krzysztof Kozlowski
2023-12-19 8:06 ` Krzysztof Kozlowski
2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-12-17 14:29 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: kernel, Yong Wu, Matthias Brugger, AngeloGioacchino Del Regno,
linux-mediatek, linux-kernel, linux-arm-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/mtk-smi.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index 6523cb510518..572c7fbdcfd3 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -566,14 +566,13 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
return ret;
}
-static int mtk_smi_larb_remove(struct platform_device *pdev)
+static void mtk_smi_larb_remove(struct platform_device *pdev)
{
struct mtk_smi_larb *larb = platform_get_drvdata(pdev);
device_link_remove(&pdev->dev, larb->smi_common_dev);
pm_runtime_disable(&pdev->dev);
component_del(&pdev->dev, &mtk_smi_larb_component_ops);
- return 0;
}
static int __maybe_unused mtk_smi_larb_resume(struct device *dev)
@@ -616,7 +615,7 @@ static const struct dev_pm_ops smi_larb_pm_ops = {
static struct platform_driver mtk_smi_larb_driver = {
.probe = mtk_smi_larb_probe,
- .remove = mtk_smi_larb_remove,
+ .remove_new = mtk_smi_larb_remove,
.driver = {
.name = "mtk-smi-larb",
.of_match_table = mtk_smi_larb_of_ids,
@@ -795,14 +794,13 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
return 0;
}
-static int mtk_smi_common_remove(struct platform_device *pdev)
+static void mtk_smi_common_remove(struct platform_device *pdev)
{
struct mtk_smi *common = dev_get_drvdata(&pdev->dev);
if (common->plat->type == MTK_SMI_GEN2_SUB_COMM)
device_link_remove(&pdev->dev, common->smi_common_dev);
pm_runtime_disable(&pdev->dev);
- return 0;
}
static int __maybe_unused mtk_smi_common_resume(struct device *dev)
@@ -842,7 +840,7 @@ static const struct dev_pm_ops smi_common_pm_ops = {
static struct platform_driver mtk_smi_common_driver = {
.probe = mtk_smi_common_probe,
- .remove = mtk_smi_common_remove,
+ .remove_new = mtk_smi_common_remove,
.driver = {
.name = "mtk-smi-common",
.of_match_table = mtk_smi_common_of_ids,
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ 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 07/15] memory: mtk-smi: " Uwe Kleine-König
@ 2023-12-19 8:06 ` Krzysztof Kozlowski
2023-12-19 8:06 ` Krzysztof Kozlowski
2 siblings, 0 replies; 4+ 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] 4+ 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 07/15] memory: mtk-smi: " 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; 4+ 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] 4+ messages in thread
end of thread, other threads:[~2023-12-19 8:06 UTC | newest]
Thread overview: 4+ 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 07/15] memory: mtk-smi: " Uwe Kleine-König
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