From patchwork Mon Mar 7 12:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 12771741 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 50EF8C433EF for ; Mon, 7 Mar 2022 12:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wRX4dnTOaYLiQ+b42IOIjOXbJoquSZEii3jixiPtMLI=; b=qjhSkhPS9WfUNU srfMQuDi8IkEuSpuXtWZJbP3nlFiGpJ0vA1C/3W8b0oe/ZTlgSFpIZLF8RWsbwrI1Yx6dR3Vsz1sW FxrwA5RB/7UVm35SpxSZRTXkvIeEfSTArazCmltBhnoh3d5mZh7mwXIVLSmztTjURFBwVHvYnhLK6 +Am3GUveyGF6RdAvPKRTvfVUyPkW/nBLb9Gl9ZVZlJMwklnHWk/FWXaJqgI2lmXGMoxm91np+ozHL K9IPviVcgFZcNBJaj4BwYeHRL24zXgDpQFomKfUnPUs9cYmpo9hjaMR/JJnzgrJ3pTnujgSpgY7kb J/ZU8uns7MShsroJGu5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRCUK-00HawQ-NY; Mon, 07 Mar 2022 12:29:21 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRCNx-00HY9i-Uf for linux-arm-kernel@lists.infradead.org; Mon, 07 Mar 2022 12:22:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646655765; x=1678191765; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gzw1D/JK60kkQYznO1thNdtqez4K8mTIcbsKDe1Y0kg=; b=C70lANYSUEKKt9bZZv7vku5+tf4tDeEav5qtdcOkkx72fC9XBgaM3c35 aEpKFas63+K/rLfL3yuEtr9hy2UySt4/8XonRMKjVxYx1ZW9HXoIwEJ58 kRYs+Lsm71Dk+PH1rmfBmtb8qqdrNTBo5nZUbZx7fEfluBTs/FVNdTT3c mAVioPyhu+ppC1VZ0b5l/GrxNd6ABbX+bLi3v7SM6yb7DLxZ8swq7DINU Xxxlm8CyeTuBWfA2Why4N7daS2n8ok7lbFSWnY2jTrtyXMSNDbAzur/0B i59xOSa04rAh9EdmASF+U0Dh8o8KvSZ6jon2N4JuHLjStoKOIdlJw5A+L w==; X-IronPort-AV: E=Sophos;i="5.90,162,1643698800"; d="scan'208";a="155942216" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Mar 2022 05:22:45 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 7 Mar 2022 05:22:44 -0700 Received: from rob-ult-m19940.amer.actel.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Mon, 7 Mar 2022 05:22:42 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH v3 1/6] ASoC: dmaengine: do not use a NULL prepare_slave_config() callback Date: Mon, 7 Mar 2022 14:21:57 +0200 Message-ID: <20220307122202.2251639-2-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220307122202.2251639-1-codrin.ciubotariu@microchip.com> References: <20220307122202.2251639-1-codrin.ciubotariu@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220307_042246_049395_312575A3 X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lars@metafoo.de, robh+dt@kernel.org, tiwai@suse.com, broonie@kernel.org, Codrin Ciubotariu , perex@perex.cz Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Even if struct snd_dmaengine_pcm_config is used, prepare_slave_config() callback might not be set. Check if this callback is set before using it. Fixes: fa654e085300 ("ASoC: dmaengine-pcm: Provide default config") Signed-off-by: Codrin Ciubotariu --- Changes in v2,v3: - none sound/soc/soc-generic-dmaengine-pcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 285441d6aeed..2ab2ddc1294d 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -86,10 +86,10 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, memset(&slave_config, 0, sizeof(slave_config)); - if (!pcm->config) - prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; - else + if (pcm->config && pcm->config->prepare_slave_config) prepare_slave_config = pcm->config->prepare_slave_config; + else + prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; if (prepare_slave_config) { int ret = prepare_slave_config(substream, params, &slave_config);