Skip to content

Commit

Permalink
ASoC: audio-graph-card2: Use cleanup.h instead of devm_kfree()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
krzk authored and broonie committed Jul 8, 2024
1 parent 5725c16 commit b39f771
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sound/soc/generic/audio-graph-card2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1350,10 +1350,9 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev,
struct graph2_custom_hooks *hooks)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
struct link_info *li;
int ret;

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

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

ret = devm_snd_soc_register_card(dev, card);
err:
devm_kfree(dev, li);

if (ret < 0)
dev_err_probe(dev, ret, "parse error\n");

Expand Down

0 comments on commit b39f771

Please sign in to comment.