From: Vinod Koul Date: Tue, 26 Jul 2016 12:36:39 +0000 (+0530) Subject: ASoC: Intel: Skylake: Check list empty while getting module info X-Git-Tag: v4.8-rc4~10^2^2~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2392f7fd695246df4fb5f0b5fb88ce37cdb01764;p=platform%2Fkernel%2Flinux-exynos.git 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 Signed-off-by: Vinod Koul Signed-off-by: Mark Brown --- diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c index 25fcb79..ddcb52a 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, uuid_mod = (uuid_le *)uuid; + if (list_empty(&ctx->uuid_list)) { + dev_err(ctx->dev, "Module list is empty\n"); + return -EINVAL; + } + list_for_each_entry(module, &ctx->uuid_list, list) { if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) { dfw_config->module_id = module->id;