From patchwork Fri Jan 13 16:18:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 642056 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 4E64FC54EBE for ; Fri, 13 Jan 2023 16:20:01 +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 551386A71; Fri, 13 Jan 2023 17:19:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 551386A71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673626799; bh=gR3lFRuixolSVgSLsxswUCJzS4/2DJJ0wiJyBOY5QgU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=t7fUdDuk5mxw3ldL1vQA5sK6dXrj/rAnpdlsThksanymYIrY83rFzQZTCSARf+tah fzd+jWlFN6SInHCVcK5/ykgFVDInkF/ATVmvcGN1AdkKE74K6N612uiz3bx0yX8EOa JunxcGdaKzsaEMe4M1pdszmGKcj7xoLNLEPRLp8k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3F8B5F8053A; Fri, 13 Jan 2023 17:18:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 706D8F8053D; Fri, 13 Jan 2023 17:18:55 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 555C0F8019B for ; Fri, 13 Jan 2023 17:18:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 555C0F8019B 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=FTSNl92I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673626734; x=1705162734; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gR3lFRuixolSVgSLsxswUCJzS4/2DJJ0wiJyBOY5QgU=; b=FTSNl92Iw414m+rQxG1bJPshJ5P9dK7caM1X6PchCP8MvOMUlMSOXW54 nJ5q5R1EI/EsWRNOvBftkJ8CPn7qHWrkHUY9OeWYZ1pnCmU41ulFo/yPk AyCXhgrRS7dQExLUE/Uk92YEmXKl69a3kIea6PQdWXv2IS6X4ziI2kGDX uRGLqd7fZMQQrcVYMyVP56p3qveXJ3Y5LqbvsFVjvOuhoEKT2GP+j1ik/ sK/mUA1djPkM5N+YDsyw46Y+GdYEsHkU5E2y8GRshAxu2TkcTxTsN/LWi CfLMCDZwr8EN6fQ3I2C47GTcXMpWho5/ektgQs2V/MMErRvDdHyzJeQUF g==; X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="324087603" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="324087603" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:51 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="690547439" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="690547439" Received: from rjmaskel-mobl1.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.27.128]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:48 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Date: Fri, 13 Jan 2023 18:18:42 +0200 Message-Id: <20230113161842.22059-4-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> References: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 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. Signed-off-by: Ranjani Sridharan Reviewed-by: Rander Wang 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 721de96fdb83..5c878788dedb 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -274,7 +274,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg struct snd_soc_dapm_path *p; /* skip 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) goto sink_unprepare; widget_ops = tplg_ops ? tplg_ops->widget : NULL; @@ -311,7 +311,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget if (!widget_ops) return 0; - 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 */