Skip to content

Commit d0cc676

Browse files
Uwe Kleine-Königbroonie
authored andcommitted
ASoC: qcom: lpass: Make asoc_qcom_lpass_cpu_platform_remove() return 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. asoc_qcom_lpass_cpu_platform_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231013221945.1489203-15-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8210f49 commit d0cc676

6 files changed

Lines changed: 6 additions & 9 deletions

File tree

sound/soc/qcom/lpass-apq8016.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static struct platform_driver apq8016_lpass_cpu_platform_driver = {
300300
.of_match_table = of_match_ptr(apq8016_lpass_cpu_device_id),
301301
},
302302
.probe = asoc_qcom_lpass_cpu_platform_probe,
303-
.remove = asoc_qcom_lpass_cpu_platform_remove,
303+
.remove_new = asoc_qcom_lpass_cpu_platform_remove,
304304
};
305305
module_platform_driver(apq8016_lpass_cpu_platform_driver);
306306

sound/soc/qcom/lpass-cpu.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,15 +1274,12 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
12741274
}
12751275
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_probe);
12761276

1277-
int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev)
1277+
void asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev)
12781278
{
12791279
struct lpass_data *drvdata = platform_get_drvdata(pdev);
12801280

12811281
if (drvdata->variant->exit)
12821282
drvdata->variant->exit(pdev);
1283-
1284-
1285-
return 0;
12861283
}
12871284
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove);
12881285

sound/soc/qcom/lpass-ipq806x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static struct platform_driver ipq806x_lpass_cpu_platform_driver = {
172172
.of_match_table = of_match_ptr(ipq806x_lpass_cpu_device_id),
173173
},
174174
.probe = asoc_qcom_lpass_cpu_platform_probe,
175-
.remove = asoc_qcom_lpass_cpu_platform_remove,
175+
.remove_new = asoc_qcom_lpass_cpu_platform_remove,
176176
};
177177
module_platform_driver(ipq806x_lpass_cpu_platform_driver);
178178

sound/soc/qcom/lpass-sc7180.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static struct platform_driver sc7180_lpass_cpu_platform_driver = {
315315
.pm = &sc7180_lpass_pm_ops,
316316
},
317317
.probe = asoc_qcom_lpass_cpu_platform_probe,
318-
.remove = asoc_qcom_lpass_cpu_platform_remove,
318+
.remove_new = asoc_qcom_lpass_cpu_platform_remove,
319319
.shutdown = asoc_qcom_lpass_cpu_platform_shutdown,
320320
};
321321

sound/soc/qcom/lpass-sc7280.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static struct platform_driver sc7280_lpass_cpu_platform_driver = {
445445
.pm = &sc7280_lpass_pm_ops,
446446
},
447447
.probe = asoc_qcom_lpass_cpu_platform_probe,
448-
.remove = asoc_qcom_lpass_cpu_platform_remove,
448+
.remove_new = asoc_qcom_lpass_cpu_platform_remove,
449449
.shutdown = asoc_qcom_lpass_cpu_platform_shutdown,
450450
};
451451

sound/soc/qcom/lpass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ struct lpass_pcm_data {
399399

400400
/* register the platform driver from the CPU DAI driver */
401401
int asoc_qcom_lpass_platform_register(struct platform_device *);
402-
int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev);
402+
void asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev);
403403
void asoc_qcom_lpass_cpu_platform_shutdown(struct platform_device *pdev);
404404
int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev);
405405
extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops;

0 commit comments

Comments
 (0)