From patchwork Thu Jan 11 10:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 187291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1362191dyi; Thu, 11 Jan 2024 02:52:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHip65vAyDcCALDI1RISgLEatljV3CWh1elppobH5zxYYrsmvtrFNbSonzkOgcCLO4o3WRT X-Received: by 2002:aa7:de07:0:b0:558:1682:59fe with SMTP id h7-20020aa7de07000000b00558168259femr534512edv.70.1704970378583; Thu, 11 Jan 2024 02:52:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704970378; cv=none; d=google.com; s=arc-20160816; b=CanVYxPsp+mJTWoK+HZUAeFUf2imBthqxzfFNBtshgLZVBhBt/WBlVQ7sCMe0EguLe 5XV8uovKB7O5YtbJ4/g8D/SvD6mJrV1co3X1t0wVmYc+kWLtLYObZRZp361H0SrLSGUd 6aSv3iFLBauwAFZtjcD164mp5puMH5NeJjDazFf4fkEskzpPmXtbZpJEZNAAztWiDyw5 vPn9UtX2rNeneRg8FZH3Rda1c5+oiJooPGJUuFx7PGZa65r3OwHkz4/h2INV09y0FsDq rAI3z/vAAlAhupu3pK6T2il9qjQB5cbx+A5CIr2XL2sS7LDqB5+a8995fE481BNjACe8 gwCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=PNWYB7aAF9o4bwewQ2dMR2CQAVg+of8feqQXBmeptiQ=; fh=2OggDnJ5+v/AnoMlXAcbF/XR/jmw4XonENtc7d1w02Y=; b=Pv189jbUapBdPo3PAVq33hb2fnzmfvom3yRbOj2iAf++h87qdkWwzzDQvsfvy6dU0w +UB+Iyl6AZZ6iA78PtiOwj7CywE/5piZ3TyPFXFFD4F+U702MBt6gSBrb7UMRr0ZdVjT DC2kftJxDZvZ4wEAFMyhkXbMCZA9uatlKQyWVAiKxo9H/HzqAdLpxAJpeCHwSNiwYjpr Vcq60CadGudId+CudpT3iRuQTpDSVeQWHETZ9Lc3JmD9SqWZLe/MSkfCNejDpPNmS7e3 T0Qf5F9xnPQxy4jhnMyGy3krFHKXPFOosmdvYhQ6EyBBzXlbPxThTW2B4ZFty7NQrgOO 2rNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=MV14cYbr; spf=pass (google.com: domain of linux-kernel+bounces-23414-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23414-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w11-20020a056402268b00b00557b08020e5si426924edd.188.2024.01.11.02.52.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 02:52:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23414-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=MV14cYbr; spf=pass (google.com: domain of linux-kernel+bounces-23414-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23414-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 35E511F24108 for ; Thu, 11 Jan 2024 10:52:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 405E814F7F; Thu, 11 Jan 2024 10:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="MV14cYbr" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1722A134D0; Thu, 11 Jan 2024 10:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970351; bh=oM426rgWRaHFG49ZkqSvY5eJEqycjUK/T8+1O717p7Y=; h=From:To:Cc:Subject:Date:From; b=MV14cYbrQRMTh3s6VbeVCU2Tu0bczc/Orb4g9f0YzLnC1H49FMbFFcIeK8s1a5dhs xQA2zLSDm/22ssekiagcTGE9NQwQaEfcmIuRSddLUeEgEo/S/eMwut/cvEeIXy4Zog QyFDaIx+sa61NqqvMFWgLsLFpwUEEbUuA5yJgINTwMoXlUGXTFu/UjeHIWRlPaM6JI 3N35SU2g+ENrpn6Pj7VgFLyRW/UD+sqVwHCNqMeLq3gYqrzf8/pz8/dWCEsi1ypDml 0COYGnOI0KMrE0f53mTne4SBXBGqqXeE3tJJULVIFibQNanEJd6XE3hvzTJr/6GysV 0RlTpmPSpWniA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 6FB1837811D1; Thu, 11 Jan 2024 10:52:30 +0000 (UTC) From: AngeloGioacchino Del Regno To: lgirdwood@gmail.com Cc: broonie@kernel.org, perex@perex.cz, tiwai@suse.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, trevor.wu@mediatek.com, kuninori.morimoto.gx@renesas.com, chunxu.li@mediatek.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] ASoC: mediatek: sof-common: Add NULL check for normal_link string Date: Thu, 11 Jan 2024 11:52:26 +0100 Message-ID: <20240111105226.117603-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787791019722116393 X-GMAIL-MSGID: 1787791019722116393 It's not granted that all entries of struct sof_conn_stream declare a `normal_link` (a non-SOF, direct link) string, and this is the case for SoCs that support only SOF paths (hence do not support both direct and SOF usecases). For example, in the case of MT8188 there is no normal_link string in any of the sof_conn_stream entries and there will be more drivers doing that in the future. To avoid possible NULL pointer KPs, add a NULL check for `normal_link`. Fixes: 0caf1120c583 ("ASoC: mediatek: mt8195: extract SOF common code") Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/common/mtk-dsp-sof-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/mediatek/common/mtk-dsp-sof-common.c b/sound/soc/mediatek/common/mtk-dsp-sof-common.c index f3894010f656..7ec8965a70c0 100644 --- a/sound/soc/mediatek/common/mtk-dsp-sof-common.c +++ b/sound/soc/mediatek/common/mtk-dsp-sof-common.c @@ -24,7 +24,7 @@ int mtk_sof_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai_link *sof_dai_link = NULL; const struct sof_conn_stream *conn = &sof_priv->conn_streams[i]; - if (strcmp(rtd->dai_link->name, conn->normal_link)) + if (conn->normal_link && strcmp(rtd->dai_link->name, conn->normal_link)) continue; for_each_card_rtds(card, runtime) {