From patchwork Wed Mar 22 18:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 13185637 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 0597BC6FD1D for ; Thu, 23 Mar 2023 13:12:11 +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 3A5F4ED7; Thu, 23 Mar 2023 14:11:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3A5F4ED7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1679577128; bh=kfN9SenAdQDA4pArUtorjPOHqmMemYP6aWKfJD2B1Ec=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=ktRLnRXymZ58LiO4NpLOlD9egAyphdGwUev2gtZl/tk1BZgOK+noAa29ENEyZBX/z 70n5e7tRRkduxHE0rz4AlssVvSMBnzf3i5m79p2ZoJl5FCUVU27g5VHVJexqvCHW2p FACJPQJflEeN72gFoPvt7EMl6NlHMdqcln+4BZbM= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0F8FEF8056F; Thu, 23 Mar 2023 14:10:18 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0CB25F8027B; Wed, 22 Mar 2023 19:19:22 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4A71EF80093 for ; Wed, 22 Mar 2023 19:19:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4A71EF80093 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=nsIZJwxR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679509155; x=1711045155; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kfN9SenAdQDA4pArUtorjPOHqmMemYP6aWKfJD2B1Ec=; b=nsIZJwxRBDsc8tlcbMRJbCIU2xzcKVX/WAhIIE1Wo/IX5lFhZegoAu0c umUBGzyQAQSQuqpttbvtw+NFJlqZGJaqM5aHx9xjLMhit71ICcgUn3eLK rUZRTBbAe8BHVzsZs24NWdBYoRbbWzrwq9HwL83HCjFdtYnwohi3shLKl liKo+qkqOhoU888iFHOM21R3kKibbg7waqIlectyMIRxpL8w4nSBDUW3h msIKdiPQrziYo9XaydLH9lYU/JVr0o98DL1jh5lUdEFjx99eRTefCKkdo mYibXv/FnzQ/k59alaNFhFxAjyAoUT5URpxwa9eM6wGWhXOgQ9NF+hea4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="425586038" X-IronPort-AV: E=Sophos;i="5.98,282,1673942400"; d="scan'208";a="425586038" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 11:19:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="1011471742" X-IronPort-AV: E=Sophos;i="5.98,282,1673942400"; d="scan'208";a="1011471742" Received: from harith2x-mobl1.gar.corp.intel.com (HELO jsarha-desk.intel.com) ([10.249.254.178]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 11:18:57 -0700 From: Jyri Sarha To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH] ASoC: SOF: ipc4/intel: Add missing mutex_unlock() Date: Wed, 22 Mar 2023 20:18:30 +0200 Message-Id: <20230322181830.574635-1-jyri.sarha@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-MailFrom: jyri.sarha@linux.intel.com 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: 5PGIIYVBEL55VRAXRDTKGII5OOYQSDI7 X-Message-ID-Hash: 5PGIIYVBEL55VRAXRDTKGII5OOYQSDI7 X-Mailman-Approved-At: Thu, 23 Mar 2023 13:10:00 +0000 CC: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, peter.ujfalusi@linux.intel.com, rander.wang@intel.com, error27@gmail.com X-Mailman-Version: 3.3.8 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: There was a missing mutex_unlock() in sof_ipc4_widget_free() use_chain_dma if-branch that caused a static analysis error. The branch should not be used in a normal working configuration and if its used its an indication of a bad topology. Add missing mutex_unlock() and a warning print if the if-branch is taken, and another warning print to a symmetric place in sof_ipc4_widget_setup(). Fixes: ca5ce0caa67fa9 ("ASoC: SOF: ipc4/intel: Add support for chained DMA") Reported-by: kernel test robot Reported-by: Dan Carpenter Link: https://lore.kernel.org/r/202303222050.dCw0fPCW-lkp@intel.com/ Signed-off-by: Jyri Sarha --- sound/soc/sof/ipc4-topology.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index f1e1aed94da4..12775fcb6b54 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -1989,8 +1989,11 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget case snd_soc_dapm_scheduler: pipeline = swidget->private; - if (pipeline->use_chain_dma) + if (pipeline->use_chain_dma) { + dev_warn(sdev->dev, "use_chain_dma set for schduler %s", + swidget->widget->name); return 0; + } dev_dbg(sdev->dev, "pipeline: %d memory pages: %d\n", swidget->pipeline_id, pipeline->mem_usage); @@ -2145,8 +2148,12 @@ static int sof_ipc4_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget struct sof_ipc4_msg msg = {{ 0 }}; u32 header; - if (pipeline->use_chain_dma) + if (pipeline->use_chain_dma) { + dev_warn(sdev->dev, "use_chain_dma set for schduler %s", + swidget->widget->name); + mutex_unlock(&ipc4_data->pipeline_state_mutex); return 0; + } header = SOF_IPC4_GLB_PIPE_INSTANCE_ID(swidget->instance_id); header |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_DELETE_PIPELINE);