Skip to content

Commit 393df6f

Browse files
Uwe Kleine-Königbroonie
authored andcommitted
ASoC: simple-card-utils: Make simple_util_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. simple_util_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> Reviewed-by: Herve Codina <herve.codina@bootlin.com> Link: https://lore.kernel.org/r/20231013221945.1489203-13-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6b02f5a commit 393df6f

7 files changed

Lines changed: 7 additions & 9 deletions

File tree

include/sound/simple_card_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ int simple_util_init_aux_jacks(struct simple_util_priv *priv,
188188
char *prefix);
189189
int simple_util_init_priv(struct simple_util_priv *priv,
190190
struct link_info *li);
191-
int simple_util_remove(struct platform_device *pdev);
191+
void simple_util_remove(struct platform_device *pdev);
192192

193193
int graph_util_card_probe(struct snd_soc_card *card);
194194
int graph_util_is_ports0(struct device_node *port);

sound/soc/generic/audio-graph-card.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ static struct platform_driver graph_card = {
644644
.of_match_table = graph_of_match,
645645
},
646646
.probe = graph_probe,
647-
.remove = simple_util_remove,
647+
.remove_new = simple_util_remove,
648648
};
649649
module_platform_driver(graph_card);
650650

sound/soc/generic/audio-graph-card2-custom-sample.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static struct platform_driver custom_card = {
176176
.of_match_table = custom_of_match,
177177
},
178178
.probe = custom_probe,
179-
.remove = simple_util_remove,
179+
.remove_new = simple_util_remove,
180180
};
181181
module_platform_driver(custom_card);
182182

sound/soc/generic/audio-graph-card2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ static struct platform_driver graph_card = {
12241224
.of_match_table = graph_of_match,
12251225
},
12261226
.probe = graph_probe,
1227-
.remove = simple_util_remove,
1227+
.remove_new = simple_util_remove,
12281228
};
12291229
module_platform_driver(graph_card);
12301230

sound/soc/generic/simple-card-utils.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,11 @@ int simple_util_init_priv(struct simple_util_priv *priv,
958958
}
959959
EXPORT_SYMBOL_GPL(simple_util_init_priv);
960960

961-
int simple_util_remove(struct platform_device *pdev)
961+
void simple_util_remove(struct platform_device *pdev)
962962
{
963963
struct snd_soc_card *card = platform_get_drvdata(pdev);
964964

965965
simple_util_clean_reference(card);
966-
967-
return 0;
968966
}
969967
EXPORT_SYMBOL_GPL(simple_util_remove);
970968

sound/soc/generic/simple-card.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ static struct platform_driver simple_card = {
827827
.of_match_table = simple_of_match,
828828
},
829829
.probe = simple_probe,
830-
.remove = simple_util_remove,
830+
.remove_new = simple_util_remove,
831831
};
832832

833833
module_platform_driver(simple_card);

sound/soc/tegra/tegra_audio_graph_card.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static struct platform_driver tegra_audio_graph_card = {
248248
.of_match_table = graph_of_tegra_match,
249249
},
250250
.probe = tegra_audio_graph_probe,
251-
.remove = simple_util_remove,
251+
.remove_new = simple_util_remove,
252252
};
253253
module_platform_driver(tegra_audio_graph_card);
254254

0 commit comments

Comments
 (0)