From patchwork Fri Mar 4 18:17:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 12769772 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 D969DC433F5 for ; Fri, 4 Mar 2022 18:19:39 +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=UbK+k8BAyRtib/YBtyCzcQAkOO2eArNosIFAMmsea+c=; b=rjL4p81SOL65aK WZ3EEeA2L3xCJZ7z1mdFBRqEUfkjPIa8gYwC0VJGpM02znkLKoFFKXSbZjXu6t/rhvAgPadAEkV51 ikZrb3E2vdx+8UxPnlllJU2bLUqysG4dMFjlG45BiKOOH4r3w04/Rl9AbDGTxvoePfY1bp/gMlIWF ekSe33p85B8corPeof7b1lUEcgXEKCahwbSHnAjEw3PMIOqFX2OMPn+FaKtVci6vB9ttKepYDrFmE kSpcf04w8HlTpnMjy4Zy1WEJF79TBFEZc80soxAsV4dhgyEOpBKUhHOLVfqLU9KqcLNde0UF3ias6 SPWKSN4vM9vJOGgH7WCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQCVf-00Ba9O-Tf; Fri, 04 Mar 2022 18:18:36 +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 1nQCVQ-00Ba3H-J4 for linux-arm-kernel@lists.infradead.org; Fri, 04 Mar 2022 18:18:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646417901; x=1677953901; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KXlre7vJPtWd2GewZg7v5Vo0cSdmJiieiW46LwNAOnA=; b=L0edjLAhr4v4o769OcIayLyOa14yV5WboCBR4NhO6l1eKtrVwPMRz/oH 9jKdW2X7vf2YPj8tuRKX5YvEEejNuAlCP/7UenbSKnqpS2nERpm1cq6xO 4amLrn8SMuUw8k4z6wWJQoPEaeE1nKFkpOE/coiHrXy5wNV2DnnQfDGMJ yQWvoHe+RuQ5VUudA8l/BiD0R3sve1vCd4AgbzfrY89b5E3OG8CJx5Vo5 WtqGC/lWhpXl1bzxVcm1p3erG13XwKEKcyRknbAAU+RnjQ+NY66299vrt BnSolVO1qVf48oOdOW/nnGUH2L5mIqvUsMIrvRS6if1iCQGs4CPebHbXl w==; X-IronPort-AV: E=Sophos;i="5.90,155,1643698800"; d="scan'208";a="155300391" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Mar 2022 11:18:20 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 4 Mar 2022 11:18:19 -0700 Received: from rob-ult-m19940.amer.actel.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 4 Mar 2022 11:18:16 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH 1/6] ASoC: dmaengine: do not use a NULL prepare_slave_config() callback Date: Fri, 4 Mar 2022 20:17:51 +0200 Message-ID: <20220304181756.1894561-2-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220304181756.1894561-1-codrin.ciubotariu@microchip.com> References: <20220304181756.1894561-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-20220304_101820_660568_C1AC136E X-CRM114-Status: GOOD ( 10.38 ) 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 --- 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);