* [PATCH 0/2] uio: Convert to platform remove callback returning void
@ 2024-03-08 21:31 Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 1/2] uio: fsl_elbc_gpcm: " Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-08 21:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel
Hello,
this series converts the two platform drivers below drivers/uio that
make use of .remove() to use .remove_new() instead.
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 drivers here get it right though and so can be
converted trivially.
This is merge window material. The two patches are independent of each
other so they can be applied individually if necessary. But I assume
and suggest that Greg will pick them up together.
Best regards
Uwe
Uwe Kleine-König (2):
uio: fsl_elbc_gpcm: Convert to platform remove callback returning void
uio: pruss: Convert to platform remove callback returning void
drivers/uio/uio_fsl_elbc_gpcm.c | 6 ++----
drivers/uio/uio_pruss.c | 5 ++---
2 files changed, 4 insertions(+), 7 deletions(-)
base-commit: 8ffc8b1bbd505e27e2c8439d326b6059c906c9dd
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] uio: fsl_elbc_gpcm: Convert to platform remove callback returning void
2024-03-08 21:31 [PATCH 0/2] uio: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-03-08 21:31 ` Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 2/2] uio: pruss: " Uwe Kleine-König
2024-04-15 7:19 ` [PATCH 0/2] uio: " Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-08 21:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: 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/uio/uio_fsl_elbc_gpcm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c
index 82dda799f327..496caff66e7e 100644
--- a/drivers/uio/uio_fsl_elbc_gpcm.c
+++ b/drivers/uio/uio_fsl_elbc_gpcm.c
@@ -427,7 +427,7 @@ static int uio_fsl_elbc_gpcm_probe(struct platform_device *pdev)
return ret;
}
-static int uio_fsl_elbc_gpcm_remove(struct platform_device *pdev)
+static void uio_fsl_elbc_gpcm_remove(struct platform_device *pdev)
{
struct uio_info *info = platform_get_drvdata(pdev);
struct fsl_elbc_gpcm *priv = info->priv;
@@ -438,8 +438,6 @@ static int uio_fsl_elbc_gpcm_remove(struct platform_device *pdev)
priv->shutdown(info, false);
iounmap(info->mem[0].internal_addr);
- return 0;
-
}
static const struct of_device_id uio_fsl_elbc_gpcm_match[] = {
@@ -455,7 +453,7 @@ static struct platform_driver uio_fsl_elbc_gpcm_driver = {
.dev_groups = uio_fsl_elbc_gpcm_groups,
},
.probe = uio_fsl_elbc_gpcm_probe,
- .remove = uio_fsl_elbc_gpcm_remove,
+ .remove_new = uio_fsl_elbc_gpcm_remove,
};
module_platform_driver(uio_fsl_elbc_gpcm_driver);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] uio: pruss: Convert to platform remove callback returning void
2024-03-08 21:31 [PATCH 0/2] uio: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 1/2] uio: fsl_elbc_gpcm: " Uwe Kleine-König
@ 2024-03-08 21:31 ` Uwe Kleine-König
2024-04-15 7:19 ` [PATCH 0/2] uio: " Uwe Kleine-König
2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-08 21:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: 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/uio/uio_pruss.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index 77e2dc404885..fb9f26468ae4 100644
--- a/drivers/uio/uio_pruss.c
+++ b/drivers/uio/uio_pruss.c
@@ -229,17 +229,16 @@ static int pruss_probe(struct platform_device *pdev)
return ret;
}
-static int pruss_remove(struct platform_device *dev)
+static void pruss_remove(struct platform_device *dev)
{
struct uio_pruss_dev *gdev = platform_get_drvdata(dev);
pruss_cleanup(&dev->dev, gdev);
- return 0;
}
static struct platform_driver pruss_driver = {
.probe = pruss_probe,
- .remove = pruss_remove,
+ .remove_new = pruss_remove,
.driver = {
.name = DRV_NAME,
},
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] uio: Convert to platform remove callback returning void
2024-03-08 21:31 [PATCH 0/2] uio: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 1/2] uio: fsl_elbc_gpcm: " Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 2/2] uio: pruss: " Uwe Kleine-König
@ 2024-04-15 7:19 ` Uwe Kleine-König
2024-04-15 7:31 ` Greg Kroah-Hartman
2 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-04-15 7:19 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
Hello,
On Fri, Mar 08, 2024 at 10:31:00PM +0100, Uwe Kleine-König wrote:
> this series converts the two platform drivers below drivers/uio that
> make use of .remove() to use .remove_new() instead.
>
> 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 drivers here get it right though and so can be
> converted trivially.
>
> This is merge window material. The two patches are independent of each
> other so they can be applied individually if necessary. But I assume
> and suggest that Greg will pick them up together.
>
> [..]
>
> Uwe Kleine-König (2):
> uio: fsl_elbc_gpcm: Convert to platform remove callback returning void
> uio: pruss: Convert to platform remove callback returning void
The commit 1019fa4839c9 ("uio: pruss: Remove this driver") (currently in
next) makes the pruss patch obsolete. The fsl_elbc_gpcm patch was
applied.
Thanks
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] 6+ messages in thread
* Re: [PATCH 0/2] uio: Convert to platform remove callback returning void
2024-04-15 7:19 ` [PATCH 0/2] uio: " Uwe Kleine-König
@ 2024-04-15 7:31 ` Greg Kroah-Hartman
2024-04-15 7:41 ` Uwe Kleine-König
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2024-04-15 7:31 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-kernel, kernel
On Mon, Apr 15, 2024 at 09:19:00AM +0200, Uwe Kleine-König wrote:
> Hello,
>
> On Fri, Mar 08, 2024 at 10:31:00PM +0100, Uwe Kleine-König wrote:
> > this series converts the two platform drivers below drivers/uio that
> > make use of .remove() to use .remove_new() instead.
> >
> > 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 drivers here get it right though and so can be
> > converted trivially.
> >
> > This is merge window material. The two patches are independent of each
> > other so they can be applied individually if necessary. But I assume
> > and suggest that Greg will pick them up together.
> >
> > [..]
> >
> > Uwe Kleine-König (2):
> > uio: fsl_elbc_gpcm: Convert to platform remove callback returning void
> > uio: pruss: Convert to platform remove callback returning void
>
> The commit 1019fa4839c9 ("uio: pruss: Remove this driver") (currently in
> next) makes the pruss patch obsolete. The fsl_elbc_gpcm patch was
> applied.
Yes, that's why I only applied one, sorry if I didn't let you know.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] uio: Convert to platform remove callback returning void
2024-04-15 7:31 ` Greg Kroah-Hartman
@ 2024-04-15 7:41 ` Uwe Kleine-König
0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-04-15 7:41 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 977 bytes --]
Hello Greg,
On Mon, Apr 15, 2024 at 09:31:35AM +0200, Greg Kroah-Hartman wrote:
> On Mon, Apr 15, 2024 at 09:19:00AM +0200, Uwe Kleine-König wrote:
> > > Uwe Kleine-König (2):
> > > uio: fsl_elbc_gpcm: Convert to platform remove callback returning void
> > > uio: pruss: Convert to platform remove callback returning void
> >
> > The commit 1019fa4839c9 ("uio: pruss: Remove this driver") (currently in
> > next) makes the pruss patch obsolete. The fsl_elbc_gpcm patch was
> > applied.
>
> Yes, that's why I only applied one, sorry if I didn't let you know.
Everything's fine on my end. Given I monitor next now with the goal to
change struct platform_driver::remove after the upcoming merge window, I
noticed myself. My message was only informational, no blame intended.
Best regards
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] 6+ messages in thread
end of thread, other threads:[~2024-04-15 7:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08 21:31 [PATCH 0/2] uio: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 1/2] uio: fsl_elbc_gpcm: " Uwe Kleine-König
2024-03-08 21:31 ` [PATCH 2/2] uio: pruss: " Uwe Kleine-König
2024-04-15 7:19 ` [PATCH 0/2] uio: " Uwe Kleine-König
2024-04-15 7:31 ` Greg Kroah-Hartman
2024-04-15 7:41 ` Uwe Kleine-König
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.