• Takashi Iwai's avatar
    ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of() · 70b77321
    Takashi Iwai authored
    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: c25e295c ("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: default avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    70b77321
common.c 2.81 KB