]> git.proxmox.com Git - mirror_ubuntu-disco-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)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 May 2019 18:55:24 +0000 (20:55 +0200)
commit1fa62d736f537dd8edff1f5899ff292bc5bfc9c5
treee8b8e213b80c9a016ab2fc361c96c90d944d47a2
parenta57be1ca306302145c450d216b22eddb9f12dd8f
ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of()

BugLink: https://bugs.launchpad.net/bugs/1828410
[ Upstream commit 70b773219a32c7b8f3e53e041bc023ad99fd81f4 ]

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: c25e295cd77b ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sound/soc/qcom/common.c