diff options
author | Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> | 2021-01-14 19:36:02 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-01-21 15:37:05 +0300 |
commit | 9c88a9838352c43550ab18080c924824bc660546 (patch) | |
tree | 0bf35145a9db52f3eea0b6614a8e8819dffe6cea /sound/soc/soc-topology.c | |
parent | d40ab86f7db3612074d08a317bdb1eb8ba06a37e (diff) | |
download | linux-9c88a9838352c43550ab18080c924824bc660546.tar.xz |
ASoC: topology: Check if ops is set before dereference
Topology can be created without ops overrides, in that case trying to
assign any value would lead to dereferencing NULL pointer.
Other places in code have either checks for tplg->ops or loop using
*_count variables, hence they can't dereference NULL pointer and there
is no need to add more checks.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20210114163602.911205-3-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 | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 0d182a190c98..5476854c12b0 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2674,11 +2674,13 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, tplg.fw = fw; tplg.dev = comp->dev; tplg.comp = comp; - tplg.ops = ops; - tplg.io_ops = ops->io_ops; - tplg.io_ops_count = ops->io_ops_count; - tplg.bytes_ext_ops = ops->bytes_ext_ops; - tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count; + if (ops) { + tplg.ops = ops; + tplg.io_ops = ops->io_ops; + tplg.io_ops_count = ops->io_ops_count; + tplg.bytes_ext_ops = ops->bytes_ext_ops; + tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count; + } ret = soc_tplg_load(&tplg); /* free the created components if fail to load topology */ |