From e65db25b8d7a3d06b96f735df13a3f7d88c8b688 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sun, 26 Mar 2023 16:32:00 +0200 Subject: [PATCH] media: via-camera: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Signed-off-by: Hans Verkuil --- drivers/media/platform/via/via-camera.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/via/via-camera.c b/drivers/media/platform/via/via-camera.c index 885917cff7385..f5181314b1d07 100644 --- a/drivers/media/platform/via/via-camera.c +++ b/drivers/media/platform/via/via-camera.c @@ -1296,7 +1296,7 @@ out_free: return ret; } -static int viacam_remove(struct platform_device *pdev) +static void viacam_remove(struct platform_device *pdev) { struct via_camera *cam = via_cam_info; struct viafb_dev *viadev = pdev->dev.platform_data; @@ -1311,7 +1311,6 @@ static int viacam_remove(struct platform_device *pdev) v4l2_ctrl_handler_free(&cam->ctrl_handler); kfree(cam); via_cam_info = NULL; - return 0; } static struct platform_driver viacam_driver = { @@ -1319,7 +1318,7 @@ static struct platform_driver viacam_driver = { .name = "viafb-camera", }, .probe = viacam_probe, - .remove = viacam_remove, + .remove_new = viacam_remove, }; module_platform_driver(viacam_driver); -- 2.30.2