[PATCH 14/24] staging: media: rkvdec: Convert to platform remove callback returning void

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Mon Apr 3 08:40:04 PDT 2023

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 (mostly) ignored
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

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 at pengutronix.de>
 drivers/staging/media/rkvdec/rkvdec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
index 7bab7586918c..3df977653ba5 100644
--- a/drivers/staging/media/rkvdec/rkvdec.c
+++ b/drivers/staging/media/rkvdec/rkvdec.c
@@ -1062,14 +1062,13 @@ static int rkvdec_probe(struct platform_device *pdev)
 	return ret;
-static int rkvdec_remove(struct platform_device *pdev)
+static void rkvdec_remove(struct platform_device *pdev)
 	struct rkvdec_dev *rkvdec = platform_get_drvdata(pdev);
-	return 0;
 #ifdef CONFIG_PM
@@ -1099,7 +1098,7 @@ static const struct dev_pm_ops rkvdec_pm_ops = {
 static struct platform_driver rkvdec_driver = {
 	.probe = rkvdec_probe,
-	.remove = rkvdec_remove,
+	.remove_new = rkvdec_remove,
 	.driver = {
 		   .name = "rkvdec",
 		   .of_match_table = of_rkvdec_match,

More information about the Linux-rockchip mailing list