ASoC: atmel: Fix error handling in snd_proto_probe
authorMiaoqian Lin <linmq006@gmail.com>
Tue, 8 Mar 2022 01:39:48 +0000 (01:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:21 +0000 (14:23 +0200)
commitf32ac9bf5e3f594ef9bfedb410aebc98cf784e69
treef6c6221e9635e82ed1a0b7267eab27b53e7730c3
parent1e77cab218e4848f2185a404a27ff6117932d1ca
ASoC: atmel: Fix error handling in snd_proto_probe

[ Upstream commit b0bfaf0544d08d093d6211d7ef8816fb0b5b6c75 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Fixes: a45f8853a5f9 ("ASoC: Add driver for PROTO Audio CODEC (with a WM8731)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220308013949.20323-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/atmel/mikroe-proto.c