Unverified Commit 696e123a authored by Johan Hovold's avatar Johan Hovold Committed by Mark Brown
Browse files

ASoC: mediatek: common: fix device and OF node leak



Make sure to drop the references to the accdet OF node and platform
device taken by of_parse_phandle() and of_find_device_by_node() after
looking up the sound component during probe.

Fixes: cf536e26 ("ASoC: mediatek: common: Handle mediatek,accdet property")
Cc: stable@vger.kernel.org	# 6.15
Cc: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20250722092542.32754-1-johan@kernel.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9e55f119
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -262,9 +262,13 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
				soc_card_data->accdet = accdet_comp;
			else
				dev_err(&pdev->dev, "No sound component found from mediatek,accdet property\n");

			put_device(&accdet_pdev->dev);
		} else {
			dev_err(&pdev->dev, "No device found from mediatek,accdet property\n");
		}

		of_node_put(accdet_node);
	}

	platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0);