Commit 9c88a983 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

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: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20210114163602.911205-3-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d40ab86f
...@@ -2674,11 +2674,13 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, ...@@ -2674,11 +2674,13 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
tplg.fw = fw; tplg.fw = fw;
tplg.dev = comp->dev; tplg.dev = comp->dev;
tplg.comp = comp; tplg.comp = comp;
tplg.ops = ops; if (ops) {
tplg.io_ops = ops->io_ops; tplg.ops = ops;
tplg.io_ops_count = ops->io_ops_count; tplg.io_ops = ops->io_ops;
tplg.bytes_ext_ops = ops->bytes_ext_ops; tplg.io_ops_count = ops->io_ops_count;
tplg.bytes_ext_ops_count = ops->bytes_ext_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); ret = soc_tplg_load(&tplg);
/* free the created components if fail to load topology */ /* free the created components if fail to load topology */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment