Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1215315pxu; Thu, 17 Dec 2020 05:09:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFxNn70bROPkL90m5e2E2j2amp0R4+CZDDg5mI8amKOJ6gUQzqcKjZMADZKTU6nX4xMNb0 X-Received: by 2002:aa7:d3d4:: with SMTP id o20mr38489439edr.190.1608210547302; Thu, 17 Dec 2020 05:09:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608210547; cv=none; d=google.com; s=arc-20160816; b=ILZ0zFFmIrcQSYVJSM5w0vKFkLBHVyI4h4o1/dVUS2CRJGfeA+wvjM+0b/UZJEznn7 dHW9iTPKKvYr2eyMWmJlvf7kyFLtduug5DsYwzyP6294+lgl8Xt1h+M9awBF11/i4ojc /coeGY2+x6O0oW/AGOZtXQOw+rnmfpI3ttMD8KmWSdi3F2bHV2Q7HliiEvsGwgBGhKg7 qcVTR3FihOsKd680bTHl5P705tMZOQcb7zUzNsw0wD6rEBLj/5YqgNqlZFImBqN2OyNj OF29iEyiPHgRTxxqXtZF0lh9v5yC38TbSSg3cQywnoavUPkcDfZfraeViO2tO7v+34mH wYig== 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=ZtWGzuysSWKbzOtA9aKqff+RXT8SeMJQrKTIiGkLXlA=; b=DsuMbnXpmITscDqUIWXrcHPYZwCaExx2WgHk7YfgVpdGdr52ZKm0UpFOxeMrnNNQw6 DokcERl3sfkE00TOYzXy2n9FagEPMxr/w2bRkJa0N5mN/JO55GUNa9+g3B0QQ99yryTl vnhGyjYf20Vmm5zQta6Eqk4MjFbBC5jrnYQROdt0xszH9zvsWSDaZIl0NS1wFtnL+Jva 3O7ntOhk7TgDmJi1stKWX+EmbIu4YxD35yfh+EeOxTTSGzI7H3sVSbXclBA+zulYrmqR PAxWPPYfut382hYsNTahRevGL+GXLgiCaAb1/k0Uci3i74S+Fk0FI+BQa/IPEjQSgW7k EAjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=skT21vv8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si2525846ejk.389.2020.12.17.05.08.43; Thu, 17 Dec 2020 05:09:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=skT21vv8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728024AbgLQNGt (ORCPT + 99 others); Thu, 17 Dec 2020 08:06:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726773AbgLQNGs (ORCPT ); Thu, 17 Dec 2020 08:06:48 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D07C0617A7 for ; Thu, 17 Dec 2020 05:06:08 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id s26so22459855lfc.8 for ; Thu, 17 Dec 2020 05:06:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZtWGzuysSWKbzOtA9aKqff+RXT8SeMJQrKTIiGkLXlA=; b=skT21vv8lIa2uvSWRLVkO0L4xDW1tkdv0vL+Oxl2rQ9REMRw1ikTL/FTTNzk/XgJxx 7eN+7GELuVusEB/bY8DcdGb6S8YWTnQgFxJzGTRhbUBN7ZwfsArssi9fu2copLhoS0wX dRa4yoJ5y/eJNAWGDAAEvu5DGPI3siis+1CjVkaVc6GAwCDpftNXXSvuJUq+PwvwTqjc dPHuV7O/zXFYuayKhOkM9RIY6iGSHe6cfbT0Zzjd/lLTCsppyRLmGiiUu0g7JuQ0yqsC Am3JUt5hYrwWKBG87yNHYYOTZdNJmcJkjiBQuSF6d8fDzV0XqVtWIn56D94Mw/9/8+VM ePiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZtWGzuysSWKbzOtA9aKqff+RXT8SeMJQrKTIiGkLXlA=; b=nBgLFEEKhToPD785PDlf97ViEHYOW6mmBJFHjKrodhAOd3iQtYbXxHxK9jcPkF8Tnz rrdgyhX8RSifg5X+r0skWlwoOzZK+cEsoSqvsDtL9l4hb7aRDTAqevZB5tr3zlbG8bQT 8Uuu4grwQhXuUlQlxe1jAGJsy5WnpufqssnnR+gxCXSDzct8QEvG6O0imXKgINYHVbU6 3yxdA2hvGdmB4icimnn5AixtPcw592xMS08T8ovisbMFlhaM7gKX86thOya9AtZ0DQ0N GKLwdiERrl4JS7VGt9e7yLuNN1VGFhteYRfket7WfzW2+3m/sqHz1Rn0vajrKbUVXgDB wr1A== X-Gm-Message-State: AOAM532KYvlpspzsukRJbC3Zenmqxo5CnWgznPeXHMFrVfa1ZPJdZ7oq B2AGJX+2ySN1hHgzPaNRaNZI9g== X-Received: by 2002:a19:f11e:: with SMTP id p30mr14449368lfh.395.1608210366471; Thu, 17 Dec 2020 05:06:06 -0800 (PST) Received: from localhost.localdomain (89-70-221-122.dynamic.chello.pl. [89.70.221.122]) by smtp.gmail.com with ESMTPSA id n10sm656201ljg.139.2020.12.17.05.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 05:06:05 -0800 (PST) From: Lukasz Majczak To: Pierre-Louis Bossart , Liam Girdwood , Mateusz Gorski Cc: Marcin Wojtas , Radoslaw Biernacki , Alex Levin , Guenter Roeck , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lukasz Majczak , stable@vger.kernel.org Subject: [PATCH v2] ASoC: Intel: Skylake: Check the kcontrol against NULL Date: Thu, 17 Dec 2020 14:04:39 +0100 Message-Id: <20201217130439.141943-1-lma@semihalf.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201210121438.7718-1-lma@semihalf.com> References: <20201210121438.7718-1-lma@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no check for the kcontrol against NULL and in some cases it causes kernel to crash. Fixes: 2d744ecf2b984 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT") Cc: # 5.4+ Signed-off-by: Lukasz Majczak Reviewed-by: Mateusz Gorski --- sound/soc/intel/skylake/skl-topology.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) v1 -> v2: fixed coding style diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index ae466cd592922..8f0bfda7096a9 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -3618,12 +3618,18 @@ static void skl_tplg_complete(struct snd_soc_component *component) int i; list_for_each_entry(dobj, &component->dobj_list, list) { - struct snd_kcontrol *kcontrol = dobj->control.kcontrol; - struct soc_enum *se = - (struct soc_enum *)kcontrol->private_value; - char **texts = dobj->control.dtexts; + struct snd_kcontrol *kcontrol; + struct soc_enum *se; + char **texts; char chan_text[4]; + kcontrol = dobj->control.kcontrol; + if (!kcontrol) + continue; + + se = (struct soc_enum *)kcontrol->private_value; + texts = dobj->control.dtexts; + if (dobj->type != SND_SOC_DOBJ_ENUM || dobj->control.kcontrol->put != skl_tplg_multi_config_set_dmic) -- 2.25.1