From patchwork Tue Dec 20 07:16:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subhransu S. Prusty" X-Patchwork-Id: 9481227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 342AC601C0 for ; Tue, 20 Dec 2016 07:28:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2698A2849D for ; Tue, 20 Dec 2016 07:28:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B41A284F2; Tue, 20 Dec 2016 07:28:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5FA5284F3 for ; Tue, 20 Dec 2016 07:28:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2CBE5266DD2; Tue, 20 Dec 2016 08:28:37 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A4F9D2666DB; Tue, 20 Dec 2016 08:26:15 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EAD402666DB; Tue, 20 Dec 2016 08:26:06 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by alsa0.perex.cz (Postfix) with ESMTP id 1519A26058A for ; Tue, 20 Dec 2016 08:26:01 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 19 Dec 2016 23:25:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,377,1477983600"; d="scan'208";a="914295067" Received: from subhransu-desktop.iind.intel.com ([10.223.96.135]) by orsmga003.jf.intel.com with ESMTP; 19 Dec 2016 23:25:53 -0800 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Tue, 20 Dec 2016 12:46:45 +0530 Message-Id: <1482218205-1067-1-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 Cc: tiwai@suse.de, lgirdwood@gmail.com, G Kranthi , patches.audio@intel.com, broonie@kernel.org, vinod.koul@intel.com, "Subhransu S. Prusty" Subject: [alsa-devel] [PATCH] ASoC: Intel: Skylake: Fix to fail safely if module not available in path X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: G Kranthi If a module is not available in a pipeline, fail safely rather than causing oops. Signed-off-by: G Kranthi Signed-off-by: Subhransu S. Prusty --- sound/soc/intel/skylake/skl-pcm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 10fa10d..7e97ae6 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -254,6 +254,9 @@ static int skl_pcm_open(struct snd_pcm_substream *substream, snd_pcm_set_sync(substream); mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream); + if (!mconfig) + return -EINVAL; + skl_tplg_d0i3_get(skl, mconfig->d0i3_caps); return 0;