Skip to content

Commit 5725c16

Browse files
krzkbroonie
authored andcommitted
ASoC: audio-graph-card: 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 6440e7b commit 5725c16

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88
// based on ${LINUX}/sound/soc/generic/simple-card.c
99

10+
#include <linux/cleanup.h>
1011
#include <linux/clk.h>
1112
#include <linux/device.h>
1213
#include <linux/gpio/consumer.h>
@@ -573,10 +574,9 @@ static int graph_get_dais_count(struct simple_util_priv *priv,
573574
int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev)
574575
{
575576
struct snd_soc_card *card = simple_priv_to_card(priv);
576-
struct link_info *li;
577577
int ret;
578578

579-
li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
579+
struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
580580
if (!li)
581581
return -ENOMEM;
582582

@@ -628,7 +628,6 @@ int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev)
628628
if (ret < 0)
629629
goto err;
630630

631-
devm_kfree(dev, li);
632631
return 0;
633632

634633
err:

0 commit comments

Comments
 (0)