Skip to content

Commit

Permalink
ASoC: topology: Ensure that needed parameters are set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amadeusz Sławiński authored and Mark Brown committed Jan 21, 2021
1 parent 879a67e commit d40ab86
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sound/soc/soc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit d40ab86

Please sign in to comment.