Skip to content

Commit 0842b76

Browse files
Uwe Kleine-Königmartinkpetersen
authored andcommitted
scsi: ufs: Convert all platform drivers to return 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() is renamed to .remove(). All platform drivers below drivers/ufs/ unconditionally return zero in their remove callback and so can be converted trivially to the variant returning void. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent fe15880 commit 0842b76

File tree

9 files changed

+18
-31
lines changed

9 files changed

+18
-31
lines changed

drivers/ufs/host/cdns-pltfrm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,11 @@ static int cdns_ufs_pltfrm_probe(struct platform_device *pdev)
305305
*
306306
* Return: 0 (success).
307307
*/
308-
static int cdns_ufs_pltfrm_remove(struct platform_device *pdev)
308+
static void cdns_ufs_pltfrm_remove(struct platform_device *pdev)
309309
{
310310
struct ufs_hba *hba = platform_get_drvdata(pdev);
311311

312312
ufshcd_remove(hba);
313-
return 0;
314313
}
315314

316315
static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {
@@ -322,7 +321,7 @@ static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {
322321

323322
static struct platform_driver cdns_ufs_pltfrm_driver = {
324323
.probe = cdns_ufs_pltfrm_probe,
325-
.remove = cdns_ufs_pltfrm_remove,
324+
.remove_new = cdns_ufs_pltfrm_remove,
326325
.driver = {
327326
.name = "cdns-ufshcd",
328327
.pm = &cdns_ufs_dev_pm_ops,

drivers/ufs/host/tc-dwc-g210-pltfrm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev)
7474
* @pdev: pointer to platform device structure
7575
*
7676
*/
77-
static int tc_dwc_g210_pltfm_remove(struct platform_device *pdev)
77+
static void tc_dwc_g210_pltfm_remove(struct platform_device *pdev)
7878
{
7979
struct ufs_hba *hba = platform_get_drvdata(pdev);
8080

8181
pm_runtime_get_sync(&(pdev)->dev);
8282
ufshcd_remove(hba);
83-
84-
return 0;
8583
}
8684

8785
static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
@@ -91,7 +89,7 @@ static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
9189

9290
static struct platform_driver tc_dwc_g210_pltfm_driver = {
9391
.probe = tc_dwc_g210_pltfm_probe,
94-
.remove = tc_dwc_g210_pltfm_remove,
92+
.remove_new = tc_dwc_g210_pltfm_remove,
9593
.driver = {
9694
.name = "tc-dwc-g210-pltfm",
9795
.pm = &tc_dwc_g210_pltfm_pm_ops,

drivers/ufs/host/ti-j721e-ufs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,11 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)
6565
return ret;
6666
}
6767

68-
static int ti_j721e_ufs_remove(struct platform_device *pdev)
68+
static void ti_j721e_ufs_remove(struct platform_device *pdev)
6969
{
7070
of_platform_depopulate(&pdev->dev);
7171
pm_runtime_put_sync(&pdev->dev);
7272
pm_runtime_disable(&pdev->dev);
73-
74-
return 0;
7573
}
7674

7775
static const struct of_device_id ti_j721e_ufs_of_match[] = {
@@ -85,7 +83,7 @@ MODULE_DEVICE_TABLE(of, ti_j721e_ufs_of_match);
8583

8684
static struct platform_driver ti_j721e_ufs_driver = {
8785
.probe = ti_j721e_ufs_probe,
88-
.remove = ti_j721e_ufs_remove,
86+
.remove_new = ti_j721e_ufs_remove,
8987
.driver = {
9088
.name = "ti-j721e-ufs",
9189
.of_match_table = ti_j721e_ufs_of_match,

drivers/ufs/host/ufs-exynos.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ static int exynos_ufs_probe(struct platform_device *pdev)
16051605
return err;
16061606
}
16071607

1608-
static int exynos_ufs_remove(struct platform_device *pdev)
1608+
static void exynos_ufs_remove(struct platform_device *pdev)
16091609
{
16101610
struct ufs_hba *hba = platform_get_drvdata(pdev);
16111611
struct exynos_ufs *ufs = ufshcd_get_variant(hba);
@@ -1615,8 +1615,6 @@ static int exynos_ufs_remove(struct platform_device *pdev)
16151615

16161616
phy_power_off(ufs->phy);
16171617
phy_exit(ufs->phy);
1618-
1619-
return 0;
16201618
}
16211619

16221620
static struct exynos_ufs_uic_attr exynos7_uic_attr = {
@@ -1756,7 +1754,7 @@ static const struct dev_pm_ops exynos_ufs_pm_ops = {
17561754

17571755
static struct platform_driver exynos_ufs_pltform = {
17581756
.probe = exynos_ufs_probe,
1759-
.remove = exynos_ufs_remove,
1757+
.remove_new = exynos_ufs_remove,
17601758
.driver = {
17611759
.name = "exynos-ufshc",
17621760
.pm = &exynos_ufs_pm_ops,

drivers/ufs/host/ufs-hisi.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,11 @@ static int ufs_hisi_probe(struct platform_device *pdev)
575575
return ufshcd_pltfrm_init(pdev, of_id->data);
576576
}
577577

578-
static int ufs_hisi_remove(struct platform_device *pdev)
578+
static void ufs_hisi_remove(struct platform_device *pdev)
579579
{
580580
struct ufs_hba *hba = platform_get_drvdata(pdev);
581581

582582
ufshcd_remove(hba);
583-
return 0;
584583
}
585584

586585
static const struct dev_pm_ops ufs_hisi_pm_ops = {
@@ -592,7 +591,7 @@ static const struct dev_pm_ops ufs_hisi_pm_ops = {
592591

593592
static struct platform_driver ufs_hisi_pltform = {
594593
.probe = ufs_hisi_probe,
595-
.remove = ufs_hisi_remove,
594+
.remove_new = ufs_hisi_remove,
596595
.driver = {
597596
.name = "ufshcd-hisi",
598597
.pm = &ufs_hisi_pm_ops,

drivers/ufs/host/ufs-mediatek.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,13 +1748,12 @@ static int ufs_mtk_probe(struct platform_device *pdev)
17481748
*
17491749
* Always return 0
17501750
*/
1751-
static int ufs_mtk_remove(struct platform_device *pdev)
1751+
static void ufs_mtk_remove(struct platform_device *pdev)
17521752
{
17531753
struct ufs_hba *hba = platform_get_drvdata(pdev);
17541754

17551755
pm_runtime_get_sync(&(pdev)->dev);
17561756
ufshcd_remove(hba);
1757-
return 0;
17581757
}
17591758

17601759
#ifdef CONFIG_PM_SLEEP
@@ -1818,7 +1817,7 @@ static const struct dev_pm_ops ufs_mtk_pm_ops = {
18181817

18191818
static struct platform_driver ufs_mtk_pltform = {
18201819
.probe = ufs_mtk_probe,
1821-
.remove = ufs_mtk_remove,
1820+
.remove_new = ufs_mtk_remove,
18221821
.driver = {
18231822
.name = "ufshcd-mtk",
18241823
.pm = &ufs_mtk_pm_ops,

drivers/ufs/host/ufs-qcom.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,14 +2031,13 @@ static int ufs_qcom_probe(struct platform_device *pdev)
20312031
*
20322032
* Always returns 0
20332033
*/
2034-
static int ufs_qcom_remove(struct platform_device *pdev)
2034+
static void ufs_qcom_remove(struct platform_device *pdev)
20352035
{
20362036
struct ufs_hba *hba = platform_get_drvdata(pdev);
20372037

20382038
pm_runtime_get_sync(&(pdev)->dev);
20392039
ufshcd_remove(hba);
20402040
platform_msi_domain_free_irqs(hba->dev);
2041-
return 0;
20422041
}
20432042

20442043
static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {
@@ -2070,7 +2069,7 @@ static const struct dev_pm_ops ufs_qcom_pm_ops = {
20702069

20712070
static struct platform_driver ufs_qcom_pltform = {
20722071
.probe = ufs_qcom_probe,
2073-
.remove = ufs_qcom_remove,
2072+
.remove_new = ufs_qcom_remove,
20742073
.driver = {
20752074
.name = "ufshcd-qcom",
20762075
.pm = &ufs_qcom_pm_ops,

drivers/ufs/host/ufs-renesas.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,18 +388,16 @@ static int ufs_renesas_probe(struct platform_device *pdev)
388388
return ufshcd_pltfrm_init(pdev, &ufs_renesas_vops);
389389
}
390390

391-
static int ufs_renesas_remove(struct platform_device *pdev)
391+
static void ufs_renesas_remove(struct platform_device *pdev)
392392
{
393393
struct ufs_hba *hba = platform_get_drvdata(pdev);
394394

395395
ufshcd_remove(hba);
396-
397-
return 0;
398396
}
399397

400398
static struct platform_driver ufs_renesas_platform = {
401399
.probe = ufs_renesas_probe,
402-
.remove = ufs_renesas_remove,
400+
.remove_new = ufs_renesas_remove,
403401
.driver = {
404402
.name = "ufshcd-renesas",
405403
.of_match_table = of_match_ptr(ufs_renesas_of_match),

drivers/ufs/host/ufs-sprd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,12 @@ static int ufs_sprd_probe(struct platform_device *pdev)
425425
return err;
426426
}
427427

428-
static int ufs_sprd_remove(struct platform_device *pdev)
428+
static void ufs_sprd_remove(struct platform_device *pdev)
429429
{
430430
struct ufs_hba *hba = platform_get_drvdata(pdev);
431431

432432
pm_runtime_get_sync(&(pdev)->dev);
433433
ufshcd_remove(hba);
434-
return 0;
435434
}
436435

437436
static const struct dev_pm_ops ufs_sprd_pm_ops = {
@@ -443,7 +442,7 @@ static const struct dev_pm_ops ufs_sprd_pm_ops = {
443442

444443
static struct platform_driver ufs_sprd_pltform = {
445444
.probe = ufs_sprd_probe,
446-
.remove = ufs_sprd_remove,
445+
.remove_new = ufs_sprd_remove,
447446
.driver = {
448447
.name = "ufshcd-sprd",
449448
.pm = &ufs_sprd_pm_ops,

0 commit comments

Comments
 (0)