* [PATCH] cdx: Convert to platform remove callback returning void
@ 2024-03-08 8:51 Uwe Kleine-König
2024-03-14 8:31 ` Gupta, Nipun
2024-04-13 10:12 ` Uwe Kleine-König
0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2024-03-08 8:51 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Nipun Gupta, Abhijit Gangurde, Pieter Jansen van Vuuren,
Puneet Gupta, Rob Herring, linux-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/cdx/controller/cdx_controller.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/cdx/controller/cdx_controller.c b/drivers/cdx/controller/cdx_controller.c
index 85fe4b1c4e5e..9e99baf43db1 100644
--- a/drivers/cdx/controller/cdx_controller.c
+++ b/drivers/cdx/controller/cdx_controller.c
@@ -198,7 +198,7 @@ static int xlnx_cdx_probe(struct platform_device *pdev)
return ret;
}
-static int xlnx_cdx_remove(struct platform_device *pdev)
+static void xlnx_cdx_remove(struct platform_device *pdev)
{
struct cdx_controller *cdx = platform_get_drvdata(pdev);
struct cdx_mcdi *cdx_mcdi = cdx->priv;
@@ -209,8 +209,6 @@ static int xlnx_cdx_remove(struct platform_device *pdev)
cdx_mcdi_finish(cdx_mcdi);
kfree(cdx_mcdi);
-
- return 0;
}
static const struct of_device_id cdx_match_table[] = {
@@ -227,7 +225,7 @@ static struct platform_driver cdx_pdriver = {
.of_match_table = cdx_match_table,
},
.probe = xlnx_cdx_probe,
- .remove = xlnx_cdx_remove,
+ .remove_new = xlnx_cdx_remove,
};
static int __init cdx_controller_init(void)
base-commit: 8ffc8b1bbd505e27e2c8439d326b6059c906c9dd
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] cdx: Convert to platform remove callback returning void
2024-03-08 8:51 [PATCH] cdx: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-03-14 8:31 ` Gupta, Nipun
2024-04-13 10:12 ` Uwe Kleine-König
1 sibling, 0 replies; 4+ messages in thread
From: Gupta, Nipun @ 2024-03-14 8:31 UTC (permalink / raw)
To: Uwe Kleine-König, Greg Kroah-Hartman
Cc: Abhijit Gangurde, Pieter Jansen van Vuuren, Puneet Gupta,
Rob Herring, linux-kernel, kernel
On 3/8/2024 2:21 PM, 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>
Acked-by: Nipun Gupta <nipun.gupta@amd.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cdx: Convert to platform remove callback returning void
2024-03-08 8:51 [PATCH] cdx: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-14 8:31 ` Gupta, Nipun
@ 2024-04-13 10:12 ` Uwe Kleine-König
2024-04-13 10:41 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2024-04-13 10:12 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Rob Herring, Puneet Gupta, Nipun Gupta, linux-kernel,
Abhijit Gangurde, kernel, Pieter Jansen van Vuuren
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
Hello Greg,
On Fri, Mar 08, 2024 at 09:51:05AM +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().
>
> 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>
we just talked in irc about this thread that might have fell through the
cracks on your side.
Thanks for reconsidering to apply it for v6.10-rc1,
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cdx: Convert to platform remove callback returning void
2024-04-13 10:12 ` Uwe Kleine-König
@ 2024-04-13 10:41 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2024-04-13 10:41 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Rob Herring, Puneet Gupta, Nipun Gupta, linux-kernel,
Abhijit Gangurde, kernel, Pieter Jansen van Vuuren
On Sat, Apr 13, 2024 at 12:12:56PM +0200, Uwe Kleine-König wrote:
> Hello Greg,
>
> On Fri, Mar 08, 2024 at 09:51:05AM +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().
> >
> > 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>
>
> we just talked in irc about this thread that might have fell through the
> cracks on your side.
>
> Thanks for reconsidering to apply it for v6.10-rc1,
Now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-13 10:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 8:51 [PATCH] cdx: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-14 8:31 ` Gupta, Nipun
2024-04-13 10:12 ` Uwe Kleine-König
2024-04-13 10:41 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®