Skip to content

Commit abfec2e

Browse files
Uwe Kleine-Königpinchartl
authored andcommitted
media: bcm2835-unicam: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 48259b9 commit abfec2e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/media/platform/broadcom/bcm2835-unicam.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,7 +2704,7 @@ static int unicam_probe(struct platform_device *pdev)
27042704
return ret;
27052705
}
27062706

2707-
static int unicam_remove(struct platform_device *pdev)
2707+
static void unicam_remove(struct platform_device *pdev)
27082708
{
27092709
struct unicam_device *unicam = platform_get_drvdata(pdev);
27102710

@@ -2718,8 +2718,6 @@ static int unicam_remove(struct platform_device *pdev)
27182718
unicam_put(unicam);
27192719

27202720
pm_runtime_disable(&pdev->dev);
2721-
2722-
return 0;
27232721
}
27242722

27252723
static const struct of_device_id unicam_of_match[] = {
@@ -2730,7 +2728,7 @@ MODULE_DEVICE_TABLE(of, unicam_of_match);
27302728

27312729
static struct platform_driver unicam_driver = {
27322730
.probe = unicam_probe,
2733-
.remove = unicam_remove,
2731+
.remove_new = unicam_remove,
27342732
.driver = {
27352733
.name = UNICAM_MODULE_NAME,
27362734
.pm = pm_ptr(&unicam_pm_ops),

0 commit comments

Comments
 (0)