Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: vimc-core: 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 <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Uwe Kleine-König and committed by
Hans Verkuil
19136807 a4e1d46f

+2 -4
+2 -4
drivers/media/test-drivers/vimc/vimc-core.c
··· 387 387 return 0; 388 388 } 389 389 390 - static int vimc_remove(struct platform_device *pdev) 390 + static void vimc_remove(struct platform_device *pdev) 391 391 { 392 392 struct vimc_device *vimc = platform_get_drvdata(pdev); 393 393 ··· 397 397 media_device_unregister(&vimc->mdev); 398 398 v4l2_device_unregister(&vimc->v4l2_dev); 399 399 v4l2_device_put(&vimc->v4l2_dev); 400 - 401 - return 0; 402 400 } 403 401 404 402 static void vimc_dev_release(struct device *dev) ··· 410 412 411 413 static struct platform_driver vimc_pdrv = { 412 414 .probe = vimc_probe, 413 - .remove = vimc_remove, 415 + .remove_new = vimc_remove, 414 416 .driver = { 415 417 .name = VIMC_PDEV_NAME, 416 418 },