* [PATCH net-next 00/10] net*: Convert to platform remove callback returning void
@ 2023-11-17 9:59 Uwe Kleine-König
2023-11-17 9:59 ` [PATCH net-next 08/10] net: wwan: qcom_bam_dmux: " Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2023-11-17 9:59 UTC (permalink / raw)
To: Alex Elder, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rafael J. Wysocki, Dmitry Torokhov, Tariq Toukan,
Christian Marangi, Dawei Li, Clément Léger, Andrew Lunn,
Heiner Kallweit, Russell King, Zhao Qiang, Linus Walleij,
Imre Kaloz, Stephan Gerhold, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Loic Poulain, Sergey Ryazanov, Alexander Aring,
Stefan Schmidt, Miquel Raynal
Cc: netdev, kernel, linux-renesas-soc, linuxppc-dev, linux-arm-kernel,
Johannes Berg, linux-arm-msm, linux-wpan
Hello,
this series converts the platform drivers below drivers/net that are not
covered in the two other series converting drivers/net/ethernet and
drivers/net/wireless. I put them all in a single series even though they
are not maintained together. I thought that to be better than sending
them out individually, I hope you agree.
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.
The first patch is a fix, but I don't think it's worth to add that to
stable, it was broken since v5.7-rc1 and nobody seems to have hit the
problem.
Best regards
Uwe
Uwe Kleine-König (10):
net: ipa: Don't error out in .remove()
net: ipa: Convert to platform remove callback returning void
net: fjes: Convert to platform remove callback returning void
net: pcs: rzn1-miic: Convert to platform remove callback returning
void
net: sfp: Convert to platform remove callback returning void
net: wan/fsl_ucc_hdlc: Convert to platform remove callback returning
void
net: wan/ixp4xx_hss: Convert to platform remove callback returning
void
net: wwan: qcom_bam_dmux: Convert to platform remove callback
returning void
ieee802154: fakelb: Convert to platform remove callback returning void
ieee802154: hwsim: Convert to platform remove callback returning void
drivers/net/fjes/fjes_main.c | 6 ++----
drivers/net/ieee802154/fakelb.c | 5 ++---
drivers/net/ieee802154/mac802154_hwsim.c | 6 ++----
drivers/net/ipa/ipa_main.c | 20 +++++---------------
drivers/net/pcs/pcs-rzn1-miic.c | 6 ++----
drivers/net/phy/sfp.c | 6 ++----
drivers/net/wan/fsl_ucc_hdlc.c | 6 ++----
drivers/net/wan/ixp4xx_hss.c | 5 ++---
drivers/net/wwan/qcom_bam_dmux.c | 6 ++----
9 files changed, 21 insertions(+), 45 deletions(-)
base-commit: eff99d8edbed7918317331ebd1e365d8e955d65e
--
2.42.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next 08/10] net: wwan: qcom_bam_dmux: Convert to platform remove callback returning void
2023-11-17 9:59 [PATCH net-next 00/10] net*: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-11-17 9:59 ` Uwe Kleine-König
2023-11-22 22:23 ` Sergey Ryazanov
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2023-11-17 9:59 UTC (permalink / raw)
To: Stephan Gerhold, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Loic Poulain, Sergey Ryazanov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Johannes Berg, netdev, linux-arm-msm, 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/net/wwan/qcom_bam_dmux.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
index 17d46f4d2913..26ca719fa0de 100644
--- a/drivers/net/wwan/qcom_bam_dmux.c
+++ b/drivers/net/wwan/qcom_bam_dmux.c
@@ -846,7 +846,7 @@ static int bam_dmux_probe(struct platform_device *pdev)
return 0;
}
-static int bam_dmux_remove(struct platform_device *pdev)
+static void bam_dmux_remove(struct platform_device *pdev)
{
struct bam_dmux *dmux = platform_get_drvdata(pdev);
struct device *dev = dmux->dev;
@@ -877,8 +877,6 @@ static int bam_dmux_remove(struct platform_device *pdev)
disable_irq(dmux->pc_irq);
bam_dmux_power_off(dmux);
bam_dmux_free_skbs(dmux->tx_skbs, DMA_TO_DEVICE);
-
- return 0;
}
static const struct dev_pm_ops bam_dmux_pm_ops = {
@@ -893,7 +891,7 @@ MODULE_DEVICE_TABLE(of, bam_dmux_of_match);
static struct platform_driver bam_dmux_driver = {
.probe = bam_dmux_probe,
- .remove = bam_dmux_remove,
+ .remove_new = bam_dmux_remove,
.driver = {
.name = "bam-dmux",
.pm = &bam_dmux_pm_ops,
--
2.42.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 08/10] net: wwan: qcom_bam_dmux: Convert to platform remove callback returning void
2023-11-17 9:59 ` [PATCH net-next 08/10] net: wwan: qcom_bam_dmux: " Uwe Kleine-König
@ 2023-11-22 22:23 ` Sergey Ryazanov
0 siblings, 0 replies; 3+ messages in thread
From: Sergey Ryazanov @ 2023-11-22 22:23 UTC (permalink / raw)
To: Uwe Kleine-König, Jakub Kicinski, Bjorn Andersson,
Loic Poulain, David S. Miller, Eric Dumazet
Cc: Andy Gross, Paolo Abeni, Konrad Dybcio, Stephan Gerhold,
Johannes Berg, netdev, linux-arm-msm, kernel
On 17.11.2023 11:59, 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>
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-22 22:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-17 9:59 [PATCH net-next 00/10] net*: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-17 9:59 ` [PATCH net-next 08/10] net: wwan: qcom_bam_dmux: " Uwe Kleine-König
2023-11-22 22:23 ` Sergey Ryazanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox