diff options
author | 2016-08-26 03:05:16 +0000 | |
---|---|---|
committer | 2016-09-01 21:22:59 +0100 | |
commit | a03b0545c26d88ae92cdfc662cad4364e8c627a3 (patch) | |
tree | 179e2a26801126d097825aa0c97d4f56f2cf27b8 /sound/soc | |
parent | ASoC: simple-card-utils: add __printf attribute (diff) | |
download | linux-a03b0545c26d88ae92cdfc662cad4364e8c627a3.tar.gz linux-a03b0545c26d88ae92cdfc662cad4364e8c627a3.tar.bz2 linux-a03b0545c26d88ae92cdfc662cad4364e8c627a3.zip |
ASoC: simple-card: call of_node_put() for dai_link
We need to call of_node_put() if we used of_get_child_by_name(),
but missing it for "dai-link" loop.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/generic/simple-card.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 55638a800f20..3ce8bb6aa4ef 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -322,18 +322,21 @@ static int asoc_simple_card_parse_of(struct device_node *node, struct simple_card_data *priv) { struct device *dev = simple_priv_to_dev(priv); + struct device_node *dai_link; u32 val; int ret; if (!node) return -EINVAL; + dai_link = of_get_child_by_name(node, PREFIX "dai-link"); + /* The off-codec widgets */ if (of_property_read_bool(node, PREFIX "widgets")) { ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card, PREFIX "widgets"); if (ret) - return ret; + goto card_parse_end; } /* DAPM routes */ @@ -341,7 +344,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing"); if (ret) - return ret; + goto card_parse_end; } /* Factor to mclk, used in hw_params() */ @@ -350,7 +353,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, priv->mclk_fs = val; /* Single/Muti DAI link(s) & New style of DT node */ - if (of_get_child_by_name(node, PREFIX "dai-link")) { + if (dai_link) { struct device_node *np = NULL; int i = 0; @@ -360,7 +363,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, i, false); if (ret < 0) { of_node_put(np); - return ret; + goto card_parse_end; } i++; } @@ -368,14 +371,15 @@ static int asoc_simple_card_parse_of(struct device_node *node, /* For single DAI link & old style of DT node */ ret = asoc_simple_card_dai_link_of(node, priv, 0, true); if (ret < 0) - return ret; + goto card_parse_end; } ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX); - if (ret) - return ret; - return 0; +card_parse_end: + of_node_put(dai_link); + + return ret; } static int asoc_simple_card_probe(struct platform_device *pdev) |