diff options
author | Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> | 2021-01-14 11:36:01 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-01-21 12:37:04 +0000 |
commit | d40ab86f7db3612074d08a317bdb1eb8ba06a37e (patch) | |
tree | e865102eeeb8a477d9f01a35ce4c95b3aa8b0779 /sound/soc/soc-topology.c | |
parent | 879a67e3577020012bfad1b45aae124ec23c5db0 (diff) | |
download | lwn-d40ab86f7db3612074d08a317bdb1eb8ba06a37e.tar.gz lwn-d40ab86f7db3612074d08a317bdb1eb8ba06a37e.zip |
ASoC: topology: Ensure that needed parameters are set
As snd_soc_tplg_component_load is exported function, which means it is
part of API, there should be checks if it is called with proper
parameters.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20210114163602.911205-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-topology.c')
-rw-r--r-- | sound/soc/soc-topology.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 950c45008e24..0d182a190c98 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2659,8 +2659,14 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, struct soc_tplg tplg; int ret; - /* component needs to exist to keep and reference data while parsing */ - if (!comp) + /* + * check if we have sane parameters: + * comp - needs to exist to keep and reference data while parsing + * comp->dev - used for resource management and prints + * comp->card - used for setting card related parameters + * fw - we need it, as it is the very thing we parse + */ + if (!comp || !comp->dev || !comp->card || !fw) return -EINVAL; /* setup parsing context */ |