Skip to content

Commit b39f771

Browse files
krzkbroonie
authored andcommitted
ASoC: audio-graph-card2: Use cleanup.h instead of devm_kfree()
Allocate the memory with scoped/cleanup.h, instead of devm interface, to make the code more obvious that memory is not used outside this scope. Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Kuninori Morimoto <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 5725c16 commit b39f771

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,10 +1350,9 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
13501350
struct graph2_custom_hooks *hooks)
13511351
{
13521352
struct snd_soc_card *card = simple_priv_to_card(priv);
1353-
struct link_info *li;
13541353
int ret;
13551354

1356-
li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
1355+
struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
13571356
if (!li)
13581357
return -ENOMEM;
13591358

@@ -1417,8 +1416,6 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
14171416

14181417
ret = devm_snd_soc_register_card(dev, card);
14191418
err:
1420-
devm_kfree(dev, li);
1421-
14221419
if (ret < 0)
14231420
dev_err_probe(dev, ret, "parse error\n");
14241421

0 commit comments

Comments
 (0)