]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of()
authorTakashi Iwai <tiwai@suse.de>
Tue, 19 Feb 2019 15:46:51 +0000 (16:46 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 20 Feb 2019 16:43:42 +0000 (16:43 +0000)
commit596b783dae58c00fd3b3d4c0b41ff41e825051b2
treeb9aacc99a7e4465694a5ad2a2dce4787e4e5e06e
parentdee9b5f1eab72ba92ea20f2c65727d89405b9fa5
ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of()

Although qcom_snd_parse_of() tries to manage the of-node refcount,
there are still a few places that lead to the unblanced refcount in
the error code path.  Namely,

- for_each_child_of_node() needs to unreference the iterator node if
  aborting the loop in the middle,
- cpu, codec and platform node objects have to be unreferenced at each
  iteration,
- platform and codec node objects have to be referred before jumping
  to the error handling code that unreference them unconditionally.

This patch tries to address these by moving the assignment of platform
and codec node objects to the beginning of the loop and adding the
of_node_put() calls adequately.

Fixes: 4357d99c47e4 ("ASoC: qcom: Add support to parse common audio device nodes")
Cc: Patrick Lai <plai@codeaurora.org>
Cc: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/common.c