From: Cezary Rojewski <cezary.rojewski@intel.com>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com,
pierre-louis.bossart@linux.intel.com,
mateusz.gorski@linux.intel.com,
Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 4/8] ASoC: Intel: Skylake: Shield against no-NHLT configurations
Date: Sun, 29 Nov 2020 12:41:44 +0100 [thread overview]
Message-ID: <20201129114148.13772-5-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20201129114148.13772-1-cezary.rojewski@intel.com>
commit 9e6c382f5a6161eb55115fb56614b9827f2e7da3 upstream.
Some configurations expose no NHLT table at all within their
/sys/firmware/acpi/tables. To prevent NULL-dereference errors from
occurring, adjust probe flow and append additional safety checks in
functions involved in NHLT lifecycle.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org> # 5.4.x
---
sound/soc/intel/skylake/skl-nhlt.c | 3 ++-
sound/soc/intel/skylake/skl.c | 9 +++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index 19f328d71f24..d9c8f5cb389e 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -182,7 +182,8 @@ void skl_nhlt_remove_sysfs(struct skl_dev *skl)
{
struct device *dev = &skl->pci->dev;
- sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
+ if (skl->nhlt)
+ sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
}
/*
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 1a3a3d6a3141..2e5fbd220923 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -632,6 +632,9 @@ static int skl_clock_device_register(struct skl_dev *skl)
struct platform_device_info pdevinfo = {NULL};
struct skl_clk_pdata *clk_pdata;
+ if (!skl->nhlt)
+ return 0;
+
clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
GFP_KERNEL);
if (!clk_pdata)
@@ -1090,7 +1093,8 @@ static int skl_probe(struct pci_dev *pci,
out_clk_free:
skl_clock_device_unregister(skl);
out_nhlt_free:
- intel_nhlt_free(skl->nhlt);
+ if (skl->nhlt)
+ intel_nhlt_free(skl->nhlt);
out_free:
skl_free(bus);
@@ -1139,7 +1143,8 @@ static void skl_remove(struct pci_dev *pci)
skl_dmic_device_unregister(skl);
skl_clock_device_unregister(skl);
skl_nhlt_remove_sysfs(skl);
- intel_nhlt_free(skl->nhlt);
+ if (skl->nhlt)
+ intel_nhlt_free(skl->nhlt);
skl_free(bus);
dev_set_drvdata(&pci->dev, NULL);
}
--
2.17.1
next prev parent reply other threads:[~2020-11-29 11:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-29 11:41 [PATCH 0/8] ASoC: Intel: Skylake: Fix HDAudio and DMIC for v5.4 Cezary Rojewski
2020-11-29 11:41 ` [PATCH 1/8] ASoC: Intel: Skylake: Remove superfluous chip initialization Cezary Rojewski
2020-11-29 11:41 ` [PATCH 2/8] ASoC: Intel: Skylake: Select hda configuration permissively Cezary Rojewski
2020-11-29 11:41 ` [PATCH 3/8] ASoC: Intel: Skylake: Enable codec wakeup during chip init Cezary Rojewski
2020-11-29 11:41 ` Cezary Rojewski [this message]
2020-11-29 11:41 ` [PATCH 5/8] ASoC: Intel: Allow for ROM init retry on CNL platforms Cezary Rojewski
2020-11-29 11:41 ` [PATCH 6/8] ASoC: Intel: Skylake: Await purge request ack on CNL Cezary Rojewski
2020-11-29 11:41 ` [PATCH 7/8] ASoC: Intel: Multiple I/O PCM format support for pipe Cezary Rojewski
2020-11-29 11:41 ` [PATCH 8/8] ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT Cezary Rojewski
2020-12-01 8:43 ` [PATCH 0/8] ASoC: Intel: Skylake: Fix HDAudio and DMIC for v5.4 Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201129114148.13772-5-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mateusz.gorski@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox