Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: codecs: wcd938x: fix OF node leaks on probe failure

The component match entry release function will drop the references
taken while looking up the soundwire OF nodes when the platform device
is unbound.

Drop the additional references taken to avoid leaking them on probe
failure (e.g. probe deferral) and on driver unbind.

Fixes: 8d78602aa87a ("ASoC: codecs: wcd938x: add basic driver")
Cc: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20251201093419.24474-3-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Johan Hovold and committed by
Mark Brown
32ae6ebe 22a03ca7

+1 -2
+1 -2
sound/soc/codecs/wcd938x.c
··· 3464 3464 return -ENODEV; 3465 3465 } 3466 3466 3467 - of_node_get(wcd938x->rxnode); 3468 3467 component_match_add_release(dev, matchptr, component_release_of, 3469 3468 component_compare_of, wcd938x->rxnode); 3470 3469 ··· 3472 3473 dev_err(dev, "%s: Tx-device node not defined\n", __func__); 3473 3474 return -ENODEV; 3474 3475 } 3475 - of_node_get(wcd938x->txnode); 3476 + 3476 3477 component_match_add_release(dev, matchptr, component_release_of, 3477 3478 component_compare_of, wcd938x->txnode); 3478 3479 return 0;