From 98c58c97fd4dc16b686b8b2899d94f77ed31327e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sun, 26 Mar 2023 16:31:33 +0200 Subject: [PATCH] media: media-dev: 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/samsung/exynos4-is/media-dev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/samsung/exynos4-is/media-dev.c b/drivers/media/platform/samsung/exynos4-is/media-dev.c index 6839007..c9cb9a2 100644 --- a/drivers/media/platform/samsung/exynos4-is/media-dev.c +++ b/drivers/media/platform/samsung/exynos4-is/media-dev.c @@ -1532,12 +1532,12 @@ err_md: return ret; } -static int fimc_md_remove(struct platform_device *pdev) +static void fimc_md_remove(struct platform_device *pdev) { struct fimc_md *fmd = platform_get_drvdata(pdev); if (!fmd) - return 0; + return; fimc_md_unregister_clk_provider(fmd); v4l2_async_nf_unregister(&fmd->subdev_notifier); @@ -1550,8 +1550,6 @@ static int fimc_md_remove(struct platform_device *pdev) media_device_unregister(&fmd->media_dev); media_device_cleanup(&fmd->media_dev); fimc_md_put_clocks(fmd); - - return 0; } static const struct platform_device_id fimc_driver_ids[] __always_unused = { @@ -1568,7 +1566,7 @@ MODULE_DEVICE_TABLE(of, fimc_md_of_match); static struct platform_driver fimc_md_driver = { .probe = fimc_md_probe, - .remove = fimc_md_remove, + .remove_new = fimc_md_remove, .driver = { .of_match_table = of_match_ptr(fimc_md_of_match), .name = "s5p-fimc-md", -- 2.7.4