From patchwork Mon Mar 4 09:55:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Dulov X-Patchwork-Id: 780094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 917E5C54798 for ; Sat, 9 Mar 2024 10:13:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE35A741; Sat, 9 Mar 2024 11:13:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE35A741 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1709979200; bh=lPMlhZe6Zu/FURCZR//Lp7oBo0dSFp8zW5k/9lO6GAk=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=oasq7qxOxniFNfFHRf1aTyBJjgxzfQplkpFykx81/oVq3zcnBV/SG/3S4b+cFhDzO qZv4tzXSn9fmT9ZTRfMN16sOiswGTjbNyIUTobFxmNXxemDc6OCiv++m9ou7uAH/tY hIAmekFLAE5V6eOoRODR+YMjK9ehACA6ipWEBvVg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id F2499F80570; Sat, 9 Mar 2024 11:12:46 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 2F8F3F80570; Sat, 9 Mar 2024 11:12:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 76A55F802E8; Mon, 4 Mar 2024 10:57:13 +0100 (CET) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5A35EF80093 for ; Mon, 4 Mar 2024 10:57:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5A35EF80093 From: Daniil Dulov To: Greg Kroah-Hartman , CC: Daniil Dulov , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , , , , Ranjani Sridharan Subject: [PATCH 5.10/5.15/6.1 1/1] soundwire: stream: use consistent pattern for freeing buffers Date: Mon, 4 Mar 2024 12:55:42 +0300 Message-ID: <20240304095542.4799-2-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240304095542.4799-1-d.dulov@aladdin.ru> References: <20240304095542.4799-1-d.dulov@aladdin.ru> MIME-Version: 1.0 X-Originating-IP: [10.0.20.125] X-ClientProxiedBy: EXCH-2016-03.aladdin.ru (192.168.1.103) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-MailFrom: D.Dulov@aladdin.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: OWOHKWPC5XMBXUNZ4KURAFSMD26UM2IE X-Message-ID-Hash: OWOHKWPC5XMBXUNZ4KURAFSMD26UM2IE X-Mailman-Approved-At: Sat, 09 Mar 2024 10:09:24 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Pierre-Louis Bossart commit 5ec0c8721c06fc55d8a0bb32c403228358987eb6 upstream The code should free the message buffer used for data, the message structure used for control and assign the latter to NULL. The last part is missing for multi-link cases, and the order is inconsistent for single-link cases. Link: https://github.com/thesofproject/linux/issues/4056 Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20230119073211.85979-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Daniil Dulov --- drivers/soundwire/stream.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index a377c3d02c55..ecde6fcb8be0 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -703,8 +703,8 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count) } if (!multi_link) { - kfree(wr_msg); kfree(wbuf); + kfree(wr_msg); bus->defer_msg.msg = NULL; bus->params.curr_bank = !bus->params.curr_bank; bus->params.next_bank = !bus->params.next_bank; @@ -750,6 +750,7 @@ static int sdw_ml_sync_bank_switch(struct sdw_bus *bus, bool multi_link) if (bus->defer_msg.msg) { kfree(bus->defer_msg.msg->buf); kfree(bus->defer_msg.msg); + bus->defer_msg.msg = NULL; } return 0; @@ -847,6 +848,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) if (bus->defer_msg.msg) { kfree(bus->defer_msg.msg->buf); kfree(bus->defer_msg.msg); + bus->defer_msg.msg = NULL; } }