Skip to content

Commit

Permalink
ASoC: simple-card-utils: Don't use __free(device_node) at graph_util_…
Browse files Browse the repository at this point in the history
…parse_dai()

commit 419d191 ("ASoC: simple-card-utils: use __free(device_node) for
device node") uses __free(device_node) for dlc->of_node, but we need to
keep it while driver is in use.

Don't use __free(device_node) in graph_util_parse_dai().

Fixes: 419d191 ("ASoC: simple-card-utils: use __free(device_node) for device node")
Reported-by: Thuan Nguyen <thuan.nguyen-hong@banvien.com.vn>
Reported-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Thuan Nguyen <thuan.nguyen-hong@banvien.com.vn>
Tested-by: Detlev Casanova <detlev.casanova@collabora.com>
Link: https://patch.msgid.link/87eczisyhh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Mar 13, 2025
1 parent 658fb7f commit de74ec7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sound/soc/generic/simple-card-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,15 @@ static int graph_get_dai_id(struct device_node *ep)
int graph_util_parse_dai(struct device *dev, struct device_node *ep,
struct snd_soc_dai_link_component *dlc, int *is_single_link)
{
struct device_node *node;
struct of_phandle_args args = {};
struct snd_soc_dai *dai;
int ret;

if (!ep)
return 0;

struct device_node *node __free(device_node) = of_graph_get_port_parent(ep);
node = of_graph_get_port_parent(ep);

/*
* Try to find from DAI node
Expand Down Expand Up @@ -1126,8 +1127,10 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep,
* if he unbinded CPU or Codec.
*/
ret = snd_soc_get_dlc(&args, dlc);
if (ret < 0)
if (ret < 0) {
of_node_put(node);
return ret;
}

parse_dai_end:
if (is_single_link)
Expand Down

0 comments on commit de74ec7

Please sign in to comment.