From mboxrd@z Thu Jan 1 00:00:00 1970 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 50B19C004D4 for ; Wed, 18 Jan 2023 10:14:48 +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 27D5C3C02; Wed, 18 Jan 2023 11:13:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 27D5C3C02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674036886; bh=YLi7kReynGWMmrRJ4uPmsv6RQmdlttNSBNp4QQsQWO8=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=lAImJ48e9VZKGbQl12S39mW7DCIo1Avsx2ji5MMnVYb48uAYFdgKoUrCfz9O1Nsg+ 9CXCCY4M7d41LxVHt3ydta0rx4/ltixK6RIdcQ89BY3MV6Gk54BovEOLIHqyeGHTmU GiedHP1FjoS0Ohwp5m+K4kpQuw40BihJ1JBl33IA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D39DEF8053C; Wed, 18 Jan 2023 11:13:07 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F346F804BC; Wed, 18 Jan 2023 11:13:05 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 D0B22F8021D for ; Wed, 18 Jan 2023 11:13:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D0B22F8021D 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=OhpVXahA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674036782; x=1705572782; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YLi7kReynGWMmrRJ4uPmsv6RQmdlttNSBNp4QQsQWO8=; b=OhpVXahAYi7iQZY7vRkT9ZwjB1CLinmbrPSsOXDdS3PnoYBc1dzK5qGX WTQWvAB4dwX71YkTAJppqwW1Crp0vAkdPBFdMDHnKM5BQntBqKqx+mP9B Vj33xctFPHZ6qFkZig2jhBuLSZb3zFGA8rUEnLwgj17zrA3Vho2UsFjzq YDUacvSGLZU0SVy60jFnImvRpi35W/Nu+IPGCDEO/LIADwz1CXqCMKQ74 DM68V2fsdx5e9HC1ihDndYxeeYCXlv/aISs0c0RZKlBD8BEq+FTqKkrpY K5wiZtqBepg5ZlAIQnqGKb1SzKcXcVlQww7haHCFlEXfgkwZ2pve2xKRp w==; X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="304630448" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="304630448" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 02:12:58 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="661653814" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="661653814" Received: from kevinkeo-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.26.150]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 02:12:56 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v3 2/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Date: Wed, 18 Jan 2023 12:12:54 +0200 Message-Id: <20230118101255.29139-3-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118101255.29139-1-peter.ujfalusi@linux.intel.com> References: <20230118101255.29139-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, rander.wang@intel.com, ranjani.sridharan@linux.intel.com, yung-chuan.liao@linux.intel.com, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Ranjani Sridharan Skip preparing/unpreparing widgets if the swidget pointer is NULL. This will be true in the case of virtual widgets in topology that were added for reusing the legacy HDA machine driver with SOF. Fixes: 9862dcf70245 ("ASoC: SOF: don't unprepare widget used other pipelines") Cc: # 6.1 Signed-off-by: Ranjani Sridharan Signed-off-by: Peter Ujfalusi Reviewed-by: Rander Wang Reviewed-by: AngeloGioacchino Del Regno Tested-by: AngeloGioacchino Del Regno Signed-off-by: Peter Ujfalusi --- sound/soc/sof/sof-audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index e52ef62ce7a3..8c114e6a23c6 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -272,7 +272,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg struct snd_soc_dapm_path *p; /* return if the widget is in use or if it is already unprepared */ - if (!swidget->prepared || swidget->use_count > 0) + if (!swidget || !swidget->prepared || swidget->use_count > 0) return; if (widget_ops[widget->id].ipc_unprepare) @@ -303,7 +303,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget struct snd_soc_dapm_path *p; int ret; - if (!widget_ops[widget->id].ipc_prepare || swidget->prepared) + if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) goto sink_prepare; /* prepare the source widget */ -- 2.39.0