From patchwork Sat Nov 7 08:08:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shao.mingyin@zte.com.cn X-Patchwork-Id: 3919 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 4438D1C6EF6 for ; Sat, 7 Nov 2026 09:10:57 +0100 (CET) Authentication-Results: mxe881; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-27313-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-27313-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 25E9E37254 for ; Sat, 7 Nov 2026 08:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794038911; b=0d9ca7j1Ts3ccgyW6ZGipDuXBqOZksUi6yE7m9I5AW9uFfCFHVm0QlE1ShCVDmoQDui0 aQod76OP+B4uzF11PpxOreE8uNgeco1vwkT8ApFdHxqBLVeVbWqmgrgMd9uwzc6Y5e0bn ZlXio/f7dcBxgcGpr+tN+nogC5cyeueOgSQFNk+fKKJwkF2ot4noHqw9yDgZEeoAjliGd b9xKxrm9hTQhjZFO/iKSGYNZdQLmIzLIaMeKMhNS7gQ5OydgBlhpEvYYSXPEBbbJqO7b0 3+1OhYSW+stPSBjc01YgVoKJgYLm1pI6F2Wdonp3OJi/0XRZ7U8djrpae+lMxEB1HNQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794038911; h=X-Original-To:Received:DMARC-Filter:Received:Received:Received: X-Zmail-TransId:X-Mailer:Message-ID:In-Reply-To:References:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:Mime-Version:From:To:Cc: Subject:Content-Type:X-MAIL:X-TLS:X-ENVELOPE-SENDER:X-SOURCE-IP: X-CLEAN:X-Fangmail-Anti-Spam-Filtered:X-Fangmail-MID-QID; bh=W+DSbRgt6RPmWeWxjcN3w52/cEPdyy0qis5H5mohIiA=; b=lZSygOyaTaj5J7TrZ/lp1h3p7mjMvtEt5ZzPNEv/LxR8S/bAiorc/uv392KaVTOue5uX 7uX+YZJGxIUWKaboDJNfJpAqd0svcqJ/7dZfLsxtAp8gVFhVr2rFynxA1SEMHJ+MoGAKy ZpW9O8770UrgxObQxGMHngwOHstP7b6wUF1LMcRIhzUM4ecTNkYVmZ8fXiYW+Nq5zRiGT /o+p+ApuAKOL2lcmTARr2rdIlpnRVqySbdft3IYx8VfWMsq6Zhlqjj/J3aLUp2QjklvC2 HC2Tw9AhT/ochllr/fqPeBQcc1UFnurGMOXmtf/Bxfczx/uCH5GngxyBiWBKJ8TXJpw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08748606D806; Sat, 7 Nov 2026 08:08:31 +0000 (UTC) X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.30.148.35 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794038910; b=Okps+a+c2o3UVYc1aDzb43n3wKp5U3qQr+yjPJa0tfK9+83VyTffGQxw4YQ3wxlNVP8n XBzUqhG665cF99qhY1cdqKFCFSzSxxwH84tuIfhMiy7aT/W5lJzZOgOrWpci5wcXAZ+gH aUP9Kxh5BSDsciRrkBMfiAWvWOGrKLYmD4rHOXRSYW1D3tiJ1jMEVOrzQvdznOTdP7tgH 2+oihEN/yfHEJau9wULrPn6clGQCjMO1EuFPLbNYEUcFwJ0nK69rZzupdue3oxkC4rexW nF3UB6vSylS3od87iFZv1LFCsoJvfNYXYd9WGkI3nFtiykfneMv6jcX8jDzu0nHVXig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794038910; h=DMARC-Filter:Received:Received:Received:X-Zmail-TransId:X-Mailer: Message-ID:In-Reply-To:References:Date:Mime-Version:From:To:Cc: Subject:Content-Type:X-MAIL:X-TLS:X-ENVELOPE-SENDER:X-SOURCE-IP: X-CLEAN:X-Fangmail-Anti-Spam-Filtered:X-Fangmail-MID-QID; bh=W+DSbRgt6RPmWeWxjcN3w52/cEPdyy0qis5H5mohIiA=; b=evBCmb8xJf8BQcEQFDjsOUGmgrmWAVb30cfgakRd7HT5WCYUYjjJZ7M8PExBmq657HJz WTJn+8AP7gttPE4NPDy35HRXP7t/mQKCngDh7WeYe1/X40xXBvpoyIFCIDc1u0r2dTkvG nnNrwSJwAI7Y0VHAze0hXgTP9AFk7aNNPa9AMl/UovW5L4jFoo0PMRIpV3wocCN8IF7/f 0sQCiDs79Bp8Pw3Ff6lbdiK+/90JxsXJzYsymaUTFXyocrTeywjQ8TWkB9A0fu8+17inS 4lSjMw1k2SS1+M2m8CgvLS18q7tzOxYe03wyVkSbVcZN6TglAHwBaXMiU6WGxts0iMw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.remote-ip=160.30.148.35 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.35]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25FCC606A32E for ; Sat, 7 Nov 2026 08:08:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 25FCC606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4jM7wD5qKdz8Xrnt; Sat, 07 Nov 2026 16:08:28 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl1.zte.com.cn with SMTP id 6A788Lsp022865; Sat, 7 Nov 2026 16:08:22 +0800 (+08) (envelope-from shao.mingyin@zte.com.cn) Received: from mapi (xaxapp05[null]) by mapi (Zmail) with MAPI id mid32; Sat, 7 Nov 2026 16:08:24 +0800 (CST) X-Zmail-TransId: 2afc6aeedc78151-80d01 X-Mailer: Zmail v1.0 Message-ID: <20261107160824242Q5IY9bIPRFmXX_lzrU7ee@zte.com.cn> In-Reply-To: <20261107160815352Q4eO0zXOX0KF5AwEbOJ6f@zte.com.cn> References: 20261107160815352Q4eO0zXOX0KF5AwEbOJ6f@zte.com.cn Date: Sat, 7 Nov 2026 16:08:24 +0800 (CST) X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 From: To: , Cc: , , , , , , , , , , , , Subject: =?utf-8?q?=5BPATCH_3/5=5D_ASoC=3A_rockchip=3A_rk3399=5Fgru=5Fsound?= =?utf-8?q?=3A_fix_codec_node_reference_leak?= X-MAIL: mse-fl1.zte.com.cn 6A788Lsp022865 X-TLS: YES X-ENVELOPE-SENDER: shao.mingyin@zte.com.cn X-SOURCE-IP: 10.5.228.132 unknown Sat, 07 Nov 2026 16:08:28 +0800 X-CLEAN: YES X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6AEEDC7C.000/4jM7wD5qKdz8Xrnt X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX From: Shao Mingyin rockchip_sound_of_parse_dais() takes a reference on np_codec with of_parse_phandle() on every iteration. When the codec is disabled or does not match a known codec, the loop continues without dropping that reference, so the node is never released. Put the node on both skip paths. When the codec matches, the reference is still transferred to the DAI link, so that path is unchanged. Fixes: 0d52954ffe80 ("ASoC: rockchip: Parse dai links from dts") Signed-off-by: Shao Mingyin --- Tested on 7.3.0-next-20261030 (QEMU/TCG arm64 guest) with a synthetic device tree on the QEMU "virt" machine; no RK3399 board or audio controller is needed to reach the parse loop. A test-only hook, applied to both kernels, compares the reference count of a disabled codec node referenced by rockchip,codec with an identical unreferenced control node: unpatched patched codec refs 4, control 3 (delta 1) codec refs 3, control 3 (delta 0) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index d4a0daabfb42..d18688b74ae9 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -540,12 +540,16 @@ static int rockchip_sound_of_parse_dais(struct device *dev, if (!np_codec) break; - if (!of_device_is_available(np_codec)) + if (!of_device_is_available(np_codec)) { + of_node_put(np_codec); continue; + } index = rockchip_sound_codec_node_match(np_codec); - if (index < 0) + if (index < 0) { + of_node_put(np_codec); continue; + } switch (index) { case DAILINK_CDNDP: