Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2356262pxp; Mon, 7 Mar 2022 13:41:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJx45xi9Zh+uviqnbAt27uP4owvWh1So5YkH9N/DnQ7mmZr0an3MXilxykH8nFkIgRR/BEZF X-Received: by 2002:a17:907:3e18:b0:6da:7ac5:4ad4 with SMTP id hp24-20020a1709073e1800b006da7ac54ad4mr10828397ejc.212.1646689262982; Mon, 07 Mar 2022 13:41:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646689262; cv=none; d=google.com; s=arc-20160816; b=cNveSYfqHMJHAiqZtv0K/f3S7SPRctSoRbVPqBju6eBKo5qyYiGHvb/HOLk7f6XGR7 nk4tcVo1bP7dbeRqEBQ7G4bAUL8q0r+r+VOUSLeDVU7TQF9sbV6pFxA9keURJKDcJjJX U1gZcApctH9B1cs/kKC6b2HJYygFviVGJw4Ss2FIPbDCRiBCdYHreIUOGUqK6X6tlPTE DJPqiUTdLz1eV525J6j/u0zFGJ+kONCR1k7DFcwO5KFhCrrkQATM0TWZxfKhUVRW1/oD MuK4EqpLczfxhkA5pLk1cXI8tteAb2b6L9E3OYSCnH2y9aLO+zDgYQDVaMbwdkcvWdMz f3KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5miR2Jc+QqgaMLsx3KDf0Nh8wvwlPMBsRfCMqT9AKiU=; b=ekfEi/m08+vs2EdBdBGgo/G1clbGi2QhgyRAph8MqYpwzrYsCNrJGY8SwPHIrVXinp xDtEkFYEC5VXWXSM26elpT3zQcVRhqW7bBB99BaNManMSbLrsHaxryk7gsaMERMJ9Eso ylSd53r5NHAEcoF0Er3TUHR3brOUA9alh5IxoM+rMKb9wrmXFGLx0RHtLQwlv1cXf3Cn r6uvgwwN9EpJxs8ZT4VYI+AjsVRnjNXhCjSlWpRW8Qdt1CM939FRk5AfgH0LyaZWUE6w EKZJnWtI3tvIGBvDzHSsD4os5/d71T//JC4oke3r5fT9jPqA+IP0tt7EaumHHgtdYZ9N tqug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=C2O1t9hX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn42-20020a1709070d2a00b006db3accad43si1295064ejc.519.2022.03.07.13.40.39; Mon, 07 Mar 2022 13:41:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=C2O1t9hX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242144AbiCGMYH (ORCPT + 99 others); Mon, 7 Mar 2022 07:24:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242181AbiCGMXr (ORCPT ); Mon, 7 Mar 2022 07:23:47 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E6B63EF; Mon, 7 Mar 2022 04:22:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646655771; x=1678191771; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gzw1D/JK60kkQYznO1thNdtqez4K8mTIcbsKDe1Y0kg=; b=C2O1t9hXSs0KmpK9fWyjEek07ju5k1p+/+jmVUA8GRfz2yOM8gVMRfT2 mt5DpNWus11A0WClu9CfYqYAT/Oy8fgzATBEeVc7I0TZBXmnTs3hhctpG RdqlBPhI+jX9eXJSI8igQneoYrEmzkrgfLouKhl/bqVIweKqR13i8WoMJ 0MQjH0Z2ORouNs05qgsRyKsMlPCejh46EE0Z2+VH4zaFAPsBAKV5Iwv0y YcYQPKWZCYCNxWopA63bYRobAsqKxpa+T/i+F7QrpynCYgSzoqKQ1WMEm zhlyVwDNMvx5EIhD6w9pOyQfFyRvszpkVpVj5ZuUERawHN6M/rblaxgaZ 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: , , , CC: , , , , , , "Codrin Ciubotariu" 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 2.32.0