Skip to content

Commit abaf59c

Browse files
Uwe Kleine-Königandersson
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 7138c24 commit abaf59c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/clk/qcom/clk-cbf-8996.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,11 @@ static int qcom_msm8996_cbf_icc_register(struct platform_device *pdev, struct cl
250250
return 0;
251251
}
252252

253-
static int qcom_msm8996_cbf_icc_remove(struct platform_device *pdev)
253+
static void qcom_msm8996_cbf_icc_remove(struct platform_device *pdev)
254254
{
255255
struct icc_provider *provider = platform_get_drvdata(pdev);
256256

257257
icc_clk_unregister(provider);
258-
259-
return 0;
260258
}
261259
#define qcom_msm8996_cbf_icc_sync_state icc_sync_state
262260
#else
@@ -266,7 +264,7 @@ static int qcom_msm8996_cbf_icc_register(struct platform_device *pdev, struct c
266264

267265
return 0;
268266
}
269-
#define qcom_msm8996_cbf_icc_remove(pdev) (0)
267+
#define qcom_msm8996_cbf_icc_remove(pdev) { }
270268
#define qcom_msm8996_cbf_icc_sync_state NULL
271269
#endif
272270

@@ -340,9 +338,9 @@ static int qcom_msm8996_cbf_probe(struct platform_device *pdev)
340338
return qcom_msm8996_cbf_icc_register(pdev, &cbf_mux.clkr.hw);
341339
}
342340

343-
static int qcom_msm8996_cbf_remove(struct platform_device *pdev)
341+
static void qcom_msm8996_cbf_remove(struct platform_device *pdev)
344342
{
345-
return qcom_msm8996_cbf_icc_remove(pdev);
343+
qcom_msm8996_cbf_icc_remove(pdev);
346344
}
347345

348346
static const struct of_device_id qcom_msm8996_cbf_match_table[] = {
@@ -354,7 +352,7 @@ MODULE_DEVICE_TABLE(of, qcom_msm8996_cbf_match_table);
354352

355353
static struct platform_driver qcom_msm8996_cbf_driver = {
356354
.probe = qcom_msm8996_cbf_probe,
357-
.remove = qcom_msm8996_cbf_remove,
355+
.remove_new = qcom_msm8996_cbf_remove,
358356
.driver = {
359357
.name = "qcom-msm8996-cbf",
360358
.of_match_table = qcom_msm8996_cbf_match_table,

0 commit comments

Comments
 (0)