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

PM / devfreq: mtk-cci: 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>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Uwe Kleine-König and committed by
Chanwoo Choi
0df02586 177e15df

+2 -4
+2 -4
drivers/devfreq/mtk-cci-devfreq.c
··· 392 392 return ret; 393 393 } 394 394 395 - static int mtk_ccifreq_remove(struct platform_device *pdev) 395 + static void mtk_ccifreq_remove(struct platform_device *pdev) 396 396 { 397 397 struct device *dev = &pdev->dev; 398 398 struct mtk_ccifreq_drv *drv; ··· 405 405 regulator_disable(drv->proc_reg); 406 406 if (drv->sram_reg) 407 407 regulator_disable(drv->sram_reg); 408 - 409 - return 0; 410 408 } 411 409 412 410 static const struct mtk_ccifreq_platform_data mt8183_platform_data = { ··· 430 432 431 433 static struct platform_driver mtk_ccifreq_platdrv = { 432 434 .probe = mtk_ccifreq_probe, 433 - .remove = mtk_ccifreq_remove, 435 + .remove_new = mtk_ccifreq_remove, 434 436 .driver = { 435 437 .name = "mtk-ccifreq", 436 438 .of_match_table = mtk_ccifreq_machines,