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

clk: qcom: cbf-msm8996: 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() is renamed to .remove().

qcom_msm8996_cbf_icc_remove() returned zero unconditionally. After
changing this function to return void instead, the driver can be
converted trivially to use .remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230911151548.672485-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Uwe Kleine-König and committed by
Bjorn Andersson
abaf59c4 7138c244

+5 -7
+5 -7
drivers/clk/qcom/clk-cbf-8996.c
··· 250 250 return 0; 251 251 } 252 252 253 - static int qcom_msm8996_cbf_icc_remove(struct platform_device *pdev) 253 + static void qcom_msm8996_cbf_icc_remove(struct platform_device *pdev) 254 254 { 255 255 struct icc_provider *provider = platform_get_drvdata(pdev); 256 256 257 257 icc_clk_unregister(provider); 258 - 259 - return 0; 260 258 } 261 259 #define qcom_msm8996_cbf_icc_sync_state icc_sync_state 262 260 #else ··· 264 266 265 267 return 0; 266 268 } 267 - #define qcom_msm8996_cbf_icc_remove(pdev) (0) 269 + #define qcom_msm8996_cbf_icc_remove(pdev) { } 268 270 #define qcom_msm8996_cbf_icc_sync_state NULL 269 271 #endif 270 272 ··· 338 340 return qcom_msm8996_cbf_icc_register(pdev, &cbf_mux.clkr.hw); 339 341 } 340 342 341 - static int qcom_msm8996_cbf_remove(struct platform_device *pdev) 343 + static void qcom_msm8996_cbf_remove(struct platform_device *pdev) 342 344 { 343 - return qcom_msm8996_cbf_icc_remove(pdev); 345 + qcom_msm8996_cbf_icc_remove(pdev); 344 346 } 345 347 346 348 static const struct of_device_id qcom_msm8996_cbf_match_table[] = { ··· 352 354 353 355 static struct platform_driver qcom_msm8996_cbf_driver = { 354 356 .probe = qcom_msm8996_cbf_probe, 355 - .remove = qcom_msm8996_cbf_remove, 357 + .remove_new = qcom_msm8996_cbf_remove, 356 358 .driver = { 357 359 .name = "qcom-msm8996-cbf", 358 360 .of_match_table = qcom_msm8996_cbf_match_table,