From patchwork Mon Mar 7 10:04:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 12771469 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 1D20FC433EF for ; Mon, 7 Mar 2022 10:07:46 +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=0SCRHqi0/kdpyLRMzYhE5avrel9ax+FK8NxYzvRzLmQ=; b=kyHmRuNWRGlivi wGB4vX0Kc4GRWqDs7SnST5oIqBzF05fhqjWhz9xP5neok9S5/SpEcYLTYov6s3xwSY/fNMR5THyif HgPp+LhPv82cZ7xwRSjscGFEf/OgApw73MlBqzzzIkGtTopbdx1ydIaQyPfIfDNYhWBN/WaUjeeK9 clvoszFbZ2fWyCBW8CXav4YtP5OTZu/VW+T+IlmCiBBaBGSK4i/Lu4mEWNydXJInvGhJbOiFTy/E+ nqTNeLNMr9aaUKp0BxkWOnidzwVe7RhoPPj6vYBaN8omQkWIJDVE5bTkTfdYTffTK2LGUj7iyYMrb 1wLTVQ/17052e2vLXlzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRAG9-00GxgU-R8; Mon, 07 Mar 2022 10:06:34 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRAFm-00GxS1-Iu for linux-arm-kernel@lists.infradead.org; Mon, 07 Mar 2022 10:06:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646647570; x=1678183570; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j8rdnFqQGxQj/EbhdN6CdN2Os+QFREnEIYaYmc4cc+g=; b=fYPnrBCgk1oq70dZOUn8f9SEKMmWtfqVzAzXLQEM1BbAiDLvBDg1OwXh nhHcv2lpMqpF9Vqn+RqATs8nzxzafXqhbVG17EX/BwE2wS9lAKlGxURt3 gSbHRPS8f9YplYDW37+ObBUZmELkywJi34H80cvQn0T09vVkig5+46/SS LwoWsycNpKzgC70RTuGDIySEb497wbs79CnwSoNG8QW1n0F6xQQ5KF1WZ uD92MbJEB7a3rID36vjXTZwAsPRyKzvBgpW1FCEqwe/Wohjj6mGcYebjJ 2hZ/uH9vDxsVx06zaarhvxGCGqiErV57BZlWIK4/8FdFLNnxH3ICKFVsz A==; X-IronPort-AV: E=Sophos;i="5.90,161,1643698800"; d="scan'208";a="88045515" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Mar 2022 03:06:07 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) 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 03:05:59 -0700 Received: from rob-ult-m19940.amer.actel.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Mon, 7 Mar 2022 03:05:56 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH v2 1/6] ASoC: dmaengine: do not use a NULL prepare_slave_config() callback Date: Mon, 7 Mar 2022 12:04:23 +0200 Message-ID: <20220307100428.2227511-2-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220307100428.2227511-1-codrin.ciubotariu@microchip.com> References: <20220307100428.2227511-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_020610_746837_0E84AF61 X-CRM114-Status: GOOD ( 10.42 ) 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: - 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);