diff options
author | Vinod Koul <vinod.koul@intel.com> | 2016-07-26 08:36:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-01 12:23:37 -0400 |
commit | 2392f7fd695246df4fb5f0b5fb88ce37cdb01764 (patch) | |
tree | ed57efccf91b56eee22b7f95dc81950600d5c05e | |
parent | e7ca8fcd15049b1e48ae2ef1434a68a51ef0ead5 (diff) |
ASoC: Intel: Skylake: Check list empty while getting module info
Module list can be NULL so check if the list is empty before
accessing the list.
Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/skylake/skl-sst-utils.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c index 25fcb796bd86..ddcb52a51854 100644 --- a/sound/soc/intel/skylake/skl-sst-utils.c +++ b/sound/soc/intel/skylake/skl-sst-utils.c | |||
@@ -123,6 +123,11 @@ int snd_skl_get_module_info(struct skl_sst *ctx, u8 *uuid, | |||
123 | 123 | ||
124 | uuid_mod = (uuid_le *)uuid; | 124 | uuid_mod = (uuid_le *)uuid; |
125 | 125 | ||
126 | if (list_empty(&ctx->uuid_list)) { | ||
127 | dev_err(ctx->dev, "Module list is empty\n"); | ||
128 | return -EINVAL; | ||
129 | } | ||
130 | |||
126 | list_for_each_entry(module, &ctx->uuid_list, list) { | 131 | list_for_each_entry(module, &ctx->uuid_list, list) { |
127 | if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) { | 132 | if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) { |
128 | dfw_config->module_id = module->id; | 133 | dfw_config->module_id = module->id; |