Commit f8c9b415 authored by Yangtao Li's avatar Yangtao Li Committed by Ulf Hansson
Browse files

mmc: rtsx_usb_sdmmc: 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: default avatarYangtao Li <frank.li@vivo.com>
Link: https://lore.kernel.org/r/20230727070051.17778-23-frank.li@vivo.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 3372487a
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1379,13 +1379,13 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
	return 0;
}

static int rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
static void rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
{
	struct rtsx_usb_sdmmc *host = platform_get_drvdata(pdev);
	struct mmc_host *mmc;

	if (!host)
		return 0;
		return;

	mmc = host->mmc;
	host->host_removal = true;
@@ -1415,8 +1415,6 @@ static int rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)

	dev_dbg(&(pdev->dev),
		": Realtek USB SD/MMC module has been removed\n");

	return 0;
}

#ifdef CONFIG_PM
@@ -1455,7 +1453,7 @@ MODULE_DEVICE_TABLE(platform, rtsx_usb_sdmmc_ids);

static struct platform_driver rtsx_usb_sdmmc_driver = {
	.probe		= rtsx_usb_sdmmc_drv_probe,
	.remove		= rtsx_usb_sdmmc_drv_remove,
	.remove_new	= rtsx_usb_sdmmc_drv_remove,
	.id_table       = rtsx_usb_sdmmc_ids,
	.driver		= {
		.name	= "rtsx_usb_sdmmc",