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

mmc: 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.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com> # Broadcom
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20230727070051.17778-57-frank.li@vivo.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Yangtao Li and committed by
Ulf Hansson
1691c261 80c602b1

+11 -13
+1 -1
drivers/mmc/host/sdhci-bcm-kona.c
··· 318 318 .of_match_table = sdhci_bcm_kona_of_match, 319 319 }, 320 320 .probe = sdhci_bcm_kona_probe, 321 - .remove = sdhci_pltfm_unregister, 321 + .remove_new = sdhci_pltfm_unregister, 322 322 }; 323 323 module_platform_driver(sdhci_bcm_kona_driver); 324 324
+1 -1
drivers/mmc/host/sdhci-brcmstb.c
··· 430 430 .of_match_table = of_match_ptr(sdhci_brcm_of_match), 431 431 }, 432 432 .probe = sdhci_brcmstb_probe, 433 - .remove = sdhci_pltfm_unregister, 433 + .remove_new = sdhci_pltfm_unregister, 434 434 .shutdown = sdhci_brcmstb_shutdown, 435 435 }; 436 436
+1 -1
drivers/mmc/host/sdhci-cadence.c
··· 617 617 .of_match_table = sdhci_cdns_match, 618 618 }, 619 619 .probe = sdhci_cdns_probe, 620 - .remove = sdhci_pltfm_unregister, 620 + .remove_new = sdhci_pltfm_unregister, 621 621 }; 622 622 module_platform_driver(sdhci_cdns_driver); 623 623
+1 -1
drivers/mmc/host/sdhci-dove.c
··· 110 110 .of_match_table = sdhci_dove_of_match_table, 111 111 }, 112 112 .probe = sdhci_dove_probe, 113 - .remove = sdhci_pltfm_unregister, 113 + .remove_new = sdhci_pltfm_unregister, 114 114 }; 115 115 116 116 module_platform_driver(sdhci_dove_driver);
+1 -1
drivers/mmc/host/sdhci-iproc.c
··· 432 432 .pm = &sdhci_pltfm_pmops, 433 433 }, 434 434 .probe = sdhci_iproc_probe, 435 - .remove = sdhci_pltfm_unregister, 435 + .remove_new = sdhci_pltfm_unregister, 436 436 .shutdown = sdhci_iproc_shutdown, 437 437 }; 438 438 module_platform_driver(sdhci_iproc_driver);
+1 -1
drivers/mmc/host/sdhci-of-esdhc.c
··· 1521 1521 .pm = &esdhc_of_dev_pm_ops, 1522 1522 }, 1523 1523 .probe = sdhci_esdhc_probe, 1524 - .remove = sdhci_pltfm_unregister, 1524 + .remove_new = sdhci_pltfm_unregister, 1525 1525 }; 1526 1526 1527 1527 module_platform_driver(sdhci_esdhc_driver);
+1 -1
drivers/mmc/host/sdhci-of-hlwd.c
··· 85 85 .pm = &sdhci_pltfm_pmops, 86 86 }, 87 87 .probe = sdhci_hlwd_probe, 88 - .remove = sdhci_pltfm_unregister, 88 + .remove_new = sdhci_pltfm_unregister, 89 89 }; 90 90 91 91 module_platform_driver(sdhci_hlwd_driver);
+1 -1
drivers/mmc/host/sdhci-of-sparx5.c
··· 260 260 .pm = &sdhci_pltfm_pmops, 261 261 }, 262 262 .probe = sdhci_sparx5_probe, 263 - .remove = sdhci_pltfm_unregister, 263 + .remove_new = sdhci_pltfm_unregister, 264 264 }; 265 265 266 266 module_platform_driver(sdhci_sparx5_driver);
+1 -3
drivers/mmc/host/sdhci-pltfm.c
··· 187 187 } 188 188 EXPORT_SYMBOL_GPL(sdhci_pltfm_register); 189 189 190 - int sdhci_pltfm_unregister(struct platform_device *pdev) 190 + void sdhci_pltfm_unregister(struct platform_device *pdev) 191 191 { 192 192 struct sdhci_host *host = platform_get_drvdata(pdev); 193 193 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); ··· 196 196 sdhci_remove_host(host, dead); 197 197 clk_disable_unprepare(pltfm_host->clk); 198 198 sdhci_pltfm_free(pdev); 199 - 200 - return 0; 201 199 } 202 200 EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister); 203 201
+1 -1
drivers/mmc/host/sdhci-pltfm.h
··· 102 102 extern int sdhci_pltfm_register(struct platform_device *pdev, 103 103 const struct sdhci_pltfm_data *pdata, 104 104 size_t priv_size); 105 - extern int sdhci_pltfm_unregister(struct platform_device *pdev); 105 + extern void sdhci_pltfm_unregister(struct platform_device *pdev); 106 106 107 107 extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host); 108 108
+1 -1
drivers/mmc/host/sdhci-pxav2.c
··· 358 358 .pm = &sdhci_pltfm_pmops, 359 359 }, 360 360 .probe = sdhci_pxav2_probe, 361 - .remove = sdhci_pltfm_unregister, 361 + .remove_new = sdhci_pltfm_unregister, 362 362 }; 363 363 364 364 module_platform_driver(sdhci_pxav2_driver);