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

drm/exynos: 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 <u.kleine-koenig@pengutronix.de>
fix merge conflict and drop duplicated patch description.
Signed-off-by: Inki Dae <inki.dae@samsung.com>

authored by

Uwe Kleine-König and committed by
Inki Dae
4fe7a1ec 16ac5b21

+28 -55
+2 -4
drivers/gpu/drm/exynos/exynos5433_drm_decon.c
··· 862 862 return ret; 863 863 } 864 864 865 - static int exynos5433_decon_remove(struct platform_device *pdev) 865 + static void exynos5433_decon_remove(struct platform_device *pdev) 866 866 { 867 867 pm_runtime_disable(&pdev->dev); 868 868 869 869 component_del(&pdev->dev, &decon_component_ops); 870 - 871 - return 0; 872 870 } 873 871 874 872 struct platform_driver exynos5433_decon_driver = { 875 873 .probe = exynos5433_decon_probe, 876 - .remove = exynos5433_decon_remove, 874 + .remove_new = exynos5433_decon_remove, 877 875 .driver = { 878 876 .name = "exynos5433-decon", 879 877 .pm = pm_ptr(&exynos5433_decon_pm_ops),
+2 -4
drivers/gpu/drm/exynos/exynos7_drm_decon.c
··· 765 765 return ret; 766 766 } 767 767 768 - static int decon_remove(struct platform_device *pdev) 768 + static void decon_remove(struct platform_device *pdev) 769 769 { 770 770 struct decon_context *ctx = dev_get_drvdata(&pdev->dev); 771 771 ··· 774 774 iounmap(ctx->regs); 775 775 776 776 component_del(&pdev->dev, &decon_component_ops); 777 - 778 - return 0; 779 777 } 780 778 781 779 static int exynos7_decon_suspend(struct device *dev) ··· 838 840 839 841 struct platform_driver decon_driver = { 840 842 .probe = decon_probe, 841 - .remove = decon_remove, 843 + .remove_new = decon_remove, 842 844 .driver = { 843 845 .name = "exynos-decon", 844 846 .pm = pm_ptr(&exynos7_decon_pm_ops),
+2 -4
drivers/gpu/drm/exynos/exynos_dp.c
··· 250 250 return component_add(&pdev->dev, &exynos_dp_ops); 251 251 } 252 252 253 - static int exynos_dp_remove(struct platform_device *pdev) 253 + static void exynos_dp_remove(struct platform_device *pdev) 254 254 { 255 255 struct exynos_dp_device *dp = platform_get_drvdata(pdev); 256 256 257 257 component_del(&pdev->dev, &exynos_dp_ops); 258 258 analogix_dp_remove(dp->adp); 259 - 260 - return 0; 261 259 } 262 260 263 261 static int exynos_dp_suspend(struct device *dev) ··· 283 285 284 286 struct platform_driver dp_driver = { 285 287 .probe = exynos_dp_probe, 286 - .remove = exynos_dp_remove, 288 + .remove_new = exynos_dp_remove, 287 289 .driver = { 288 290 .name = "exynos-dp", 289 291 .owner = THIS_MODULE,
+2 -3
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 346 346 match); 347 347 } 348 348 349 - static int exynos_drm_platform_remove(struct platform_device *pdev) 349 + static void exynos_drm_platform_remove(struct platform_device *pdev) 350 350 { 351 351 component_master_del(&pdev->dev, &exynos_drm_ops); 352 - return 0; 353 352 } 354 353 355 354 static void exynos_drm_platform_shutdown(struct platform_device *pdev) ··· 361 362 362 363 static struct platform_driver exynos_drm_platform_driver = { 363 364 .probe = exynos_drm_platform_probe, 364 - .remove = exynos_drm_platform_remove, 365 + .remove_new = exynos_drm_platform_remove, 365 366 .shutdown = exynos_drm_platform_shutdown, 366 367 .driver = { 367 368 .name = "exynos-drm",
+2 -4
drivers/gpu/drm/exynos/exynos_drm_fimc.c
··· 1367 1367 return ret; 1368 1368 } 1369 1369 1370 - static int fimc_remove(struct platform_device *pdev) 1370 + static void fimc_remove(struct platform_device *pdev) 1371 1371 { 1372 1372 struct device *dev = &pdev->dev; 1373 1373 struct fimc_context *ctx = get_fimc_context(dev); ··· 1377 1377 pm_runtime_disable(dev); 1378 1378 1379 1379 fimc_put_clocks(ctx); 1380 - 1381 - return 0; 1382 1380 } 1383 1381 1384 1382 static int fimc_runtime_suspend(struct device *dev) ··· 1408 1410 1409 1411 struct platform_driver fimc_driver = { 1410 1412 .probe = fimc_probe, 1411 - .remove = fimc_remove, 1413 + .remove_new = fimc_remove, 1412 1414 .driver = { 1413 1415 .of_match_table = fimc_of_match, 1414 1416 .name = "exynos-drm-fimc",
+2 -4
drivers/gpu/drm/exynos/exynos_drm_fimd.c
··· 1277 1277 return ret; 1278 1278 } 1279 1279 1280 - static int fimd_remove(struct platform_device *pdev) 1280 + static void fimd_remove(struct platform_device *pdev) 1281 1281 { 1282 1282 pm_runtime_disable(&pdev->dev); 1283 1283 1284 1284 component_del(&pdev->dev, &fimd_component_ops); 1285 - 1286 - return 0; 1287 1285 } 1288 1286 1289 1287 static int exynos_fimd_suspend(struct device *dev) ··· 1323 1325 1324 1326 struct platform_driver fimd_driver = { 1325 1327 .probe = fimd_probe, 1326 - .remove = fimd_remove, 1328 + .remove_new = fimd_remove, 1327 1329 .driver = { 1328 1330 .name = "exynos4-fb", 1329 1331 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_drm_g2d.c
··· 1530 1530 return ret; 1531 1531 } 1532 1532 1533 - static int g2d_remove(struct platform_device *pdev) 1533 + static void g2d_remove(struct platform_device *pdev) 1534 1534 { 1535 1535 struct g2d_data *g2d = platform_get_drvdata(pdev); 1536 1536 ··· 1545 1545 g2d_fini_cmdlist(g2d); 1546 1546 destroy_workqueue(g2d->g2d_workq); 1547 1547 kmem_cache_destroy(g2d->runqueue_slab); 1548 - 1549 - return 0; 1550 1548 } 1551 1549 1552 1550 static int g2d_suspend(struct device *dev) ··· 1607 1609 1608 1610 struct platform_driver g2d_driver = { 1609 1611 .probe = g2d_probe, 1610 - .remove = g2d_remove, 1612 + .remove_new = g2d_remove, 1611 1613 .driver = { 1612 1614 .name = "exynos-drm-g2d", 1613 1615 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_drm_gsc.c
··· 1309 1309 return ret; 1310 1310 } 1311 1311 1312 - static int gsc_remove(struct platform_device *pdev) 1312 + static void gsc_remove(struct platform_device *pdev) 1313 1313 { 1314 1314 struct device *dev = &pdev->dev; 1315 1315 1316 1316 component_del(dev, &gsc_component_ops); 1317 1317 pm_runtime_dont_use_autosuspend(dev); 1318 1318 pm_runtime_disable(dev); 1319 - 1320 - return 0; 1321 1319 } 1322 1320 1323 1321 static int __maybe_unused gsc_runtime_suspend(struct device *dev) ··· 1420 1422 1421 1423 struct platform_driver gsc_driver = { 1422 1424 .probe = gsc_probe, 1423 - .remove = gsc_remove, 1425 + .remove_new = gsc_remove, 1424 1426 .driver = { 1425 1427 .name = "exynos-drm-gsc", 1426 1428 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_drm_mic.c
··· 442 442 return ret; 443 443 } 444 444 445 - static int exynos_mic_remove(struct platform_device *pdev) 445 + static void exynos_mic_remove(struct platform_device *pdev) 446 446 { 447 447 struct exynos_mic *mic = platform_get_drvdata(pdev); 448 448 ··· 450 450 pm_runtime_disable(&pdev->dev); 451 451 452 452 drm_bridge_remove(&mic->bridge); 453 - 454 - return 0; 455 453 } 456 454 457 455 static const struct of_device_id exynos_mic_of_match[] = { ··· 460 462 461 463 struct platform_driver mic_driver = { 462 464 .probe = exynos_mic_probe, 463 - .remove = exynos_mic_remove, 465 + .remove_new = exynos_mic_remove, 464 466 .driver = { 465 467 .name = "exynos-mic", 466 468 .pm = pm_ptr(&exynos_mic_pm_ops),
+2 -4
drivers/gpu/drm/exynos/exynos_drm_rotator.c
··· 329 329 return ret; 330 330 } 331 331 332 - static int rotator_remove(struct platform_device *pdev) 332 + static void rotator_remove(struct platform_device *pdev) 333 333 { 334 334 struct device *dev = &pdev->dev; 335 335 336 336 component_del(dev, &rotator_component_ops); 337 337 pm_runtime_dont_use_autosuspend(dev); 338 338 pm_runtime_disable(dev); 339 - 340 - return 0; 341 339 } 342 340 343 341 static int rotator_runtime_suspend(struct device *dev) ··· 451 453 452 454 struct platform_driver rotator_driver = { 453 455 .probe = rotator_probe, 454 - .remove = rotator_remove, 456 + .remove_new = rotator_remove, 455 457 .driver = { 456 458 .name = "exynos-rotator", 457 459 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_drm_scaler.c
··· 539 539 return ret; 540 540 } 541 541 542 - static int scaler_remove(struct platform_device *pdev) 542 + static void scaler_remove(struct platform_device *pdev) 543 543 { 544 544 struct device *dev = &pdev->dev; 545 545 546 546 component_del(dev, &scaler_component_ops); 547 547 pm_runtime_dont_use_autosuspend(dev); 548 548 pm_runtime_disable(dev); 549 - 550 - return 0; 551 549 } 552 550 553 551 static int clk_disable_unprepare_wrapper(struct clk *clk) ··· 719 721 720 722 struct platform_driver scaler_driver = { 721 723 .probe = scaler_probe, 722 - .remove = scaler_remove, 724 + .remove_new = scaler_remove, 723 725 .driver = { 724 726 .name = "exynos-scaler", 725 727 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_drm_vidi.c
··· 462 462 return component_add(dev, &vidi_component_ops); 463 463 } 464 464 465 - static int vidi_remove(struct platform_device *pdev) 465 + static void vidi_remove(struct platform_device *pdev) 466 466 { 467 467 struct vidi_context *ctx = platform_get_drvdata(pdev); 468 468 ··· 472 472 } 473 473 474 474 component_del(&pdev->dev, &vidi_component_ops); 475 - 476 - return 0; 477 475 } 478 476 479 477 struct platform_driver vidi_driver = { 480 478 .probe = vidi_probe, 481 - .remove = vidi_remove, 479 + .remove_new = vidi_remove, 482 480 .driver = { 483 481 .name = "exynos-drm-vidi", 484 482 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_hdmi.c
··· 2069 2069 return ret; 2070 2070 } 2071 2071 2072 - static int hdmi_remove(struct platform_device *pdev) 2072 + static void hdmi_remove(struct platform_device *pdev) 2073 2073 { 2074 2074 struct hdmi_context *hdata = platform_get_drvdata(pdev); 2075 2075 ··· 2092 2092 put_device(&hdata->ddc_adpt->dev); 2093 2093 2094 2094 mutex_destroy(&hdata->mutex); 2095 - 2096 - return 0; 2097 2095 } 2098 2096 2099 2097 static int __maybe_unused exynos_hdmi_suspend(struct device *dev) ··· 2123 2125 2124 2126 struct platform_driver hdmi_driver = { 2125 2127 .probe = hdmi_probe, 2126 - .remove = hdmi_remove, 2128 + .remove_new = hdmi_remove, 2127 2129 .driver = { 2128 2130 .name = "exynos-hdmi", 2129 2131 .owner = THIS_MODULE,
+2 -4
drivers/gpu/drm/exynos/exynos_mixer.c
··· 1258 1258 return ret; 1259 1259 } 1260 1260 1261 - static int mixer_remove(struct platform_device *pdev) 1261 + static void mixer_remove(struct platform_device *pdev) 1262 1262 { 1263 1263 pm_runtime_disable(&pdev->dev); 1264 1264 1265 1265 component_del(&pdev->dev, &mixer_component_ops); 1266 - 1267 - return 0; 1268 1266 } 1269 1267 1270 1268 static int __maybe_unused exynos_mixer_suspend(struct device *dev) ··· 1336 1338 .of_match_table = mixer_match_types, 1337 1339 }, 1338 1340 .probe = mixer_probe, 1339 - .remove = mixer_remove, 1341 + .remove_new = mixer_remove, 1340 1342 };