diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2016-08-25 23:05:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-09-01 16:22:59 -0400 |
commit | a03b0545c26d88ae92cdfc662cad4364e8c627a3 (patch) | |
tree | 179e2a26801126d097825aa0c97d4f56f2cf27b8 | |
parent | e5668caec5698f14f310fb06bb39595b21d2fe4a (diff) |
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>
-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, | |||
322 | struct simple_card_data *priv) | 322 | struct simple_card_data *priv) |
323 | { | 323 | { |
324 | struct device *dev = simple_priv_to_dev(priv); | 324 | struct device *dev = simple_priv_to_dev(priv); |
325 | struct device_node *dai_link; | ||
325 | u32 val; | 326 | u32 val; |
326 | int ret; | 327 | int ret; |
327 | 328 | ||
328 | if (!node) | 329 | if (!node) |
329 | return -EINVAL; | 330 | return -EINVAL; |
330 | 331 | ||
332 | dai_link = of_get_child_by_name(node, PREFIX "dai-link"); | ||
333 | |||
331 | /* The off-codec widgets */ | 334 | /* The off-codec widgets */ |
332 | if (of_property_read_bool(node, PREFIX "widgets")) { | 335 | if (of_property_read_bool(node, PREFIX "widgets")) { |
333 | ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card, | 336 | ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card, |
334 | PREFIX "widgets"); | 337 | PREFIX "widgets"); |
335 | if (ret) | 338 | if (ret) |
336 | return ret; | 339 | goto card_parse_end; |
337 | } | 340 | } |
338 | 341 | ||
339 | /* DAPM routes */ | 342 | /* DAPM routes */ |
@@ -341,7 +344,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
341 | ret = snd_soc_of_parse_audio_routing(&priv->snd_card, | 344 | ret = snd_soc_of_parse_audio_routing(&priv->snd_card, |
342 | PREFIX "routing"); | 345 | PREFIX "routing"); |
343 | if (ret) | 346 | if (ret) |
344 | return ret; | 347 | goto card_parse_end; |
345 | } | 348 | } |
346 | 349 | ||
347 | /* Factor to mclk, used in hw_params() */ | 350 | /* Factor to mclk, used in hw_params() */ |
@@ -350,7 +353,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
350 | priv->mclk_fs = val; | 353 | priv->mclk_fs = val; |
351 | 354 | ||
352 | /* Single/Muti DAI link(s) & New style of DT node */ | 355 | /* Single/Muti DAI link(s) & New style of DT node */ |
353 | if (of_get_child_by_name(node, PREFIX "dai-link")) { | 356 | if (dai_link) { |
354 | struct device_node *np = NULL; | 357 | struct device_node *np = NULL; |
355 | int i = 0; | 358 | int i = 0; |
356 | 359 | ||
@@ -360,7 +363,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
360 | i, false); | 363 | i, false); |
361 | if (ret < 0) { | 364 | if (ret < 0) { |
362 | of_node_put(np); | 365 | of_node_put(np); |
363 | return ret; | 366 | goto card_parse_end; |
364 | } | 367 | } |
365 | i++; | 368 | i++; |
366 | } | 369 | } |
@@ -368,14 +371,15 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
368 | /* For single DAI link & old style of DT node */ | 371 | /* For single DAI link & old style of DT node */ |
369 | ret = asoc_simple_card_dai_link_of(node, priv, 0, true); | 372 | ret = asoc_simple_card_dai_link_of(node, priv, 0, true); |
370 | if (ret < 0) | 373 | if (ret < 0) |
371 | return ret; | 374 | goto card_parse_end; |
372 | } | 375 | } |
373 | 376 | ||
374 | ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX); | 377 | ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX); |
375 | if (ret) | ||
376 | return ret; | ||
377 | 378 | ||
378 | return 0; | 379 | card_parse_end: |
380 | of_node_put(dai_link); | ||
381 | |||
382 | return ret; | ||
379 | } | 383 | } |
380 | 384 | ||
381 | static int asoc_simple_card_probe(struct platform_device *pdev) | 385 | static int asoc_simple_card_probe(struct platform_device *pdev) |