From: Uwe Kleine-König Date: Sun, 26 Mar 2023 14:32:00 +0000 (+0200) Subject: media: via-camera: Convert to platform remove callback returning void X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e65db25b8d7a3d06b96f735df13a3f7d88c8b688;p=linux.git media: via-camera: Convert to platform remove callback returning void 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 --- 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);