]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: Intel: Skylake: Fix passing loadable flag for module
authorGustaw Lewandowski <gustaw.lewandowski@linux.intel.com>
Wed, 18 Aug 2021 07:57:37 +0000 (09:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:34 +0000 (12:26 +0200)
[ Upstream commit c5ed9c547cba1dc1238c6e8a0c290fd62ee6e127 ]

skl_get_module_info() tries to set mconfig->module->loadable before
mconfig->module has been assigned thus flag was always set to false
and driver did not try to load module binaries.

Signed-off-by: Gustaw Lewandowski <gustaw.lewandowski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Tested-by: Lukasz Majczak <lma@semihalf.com>
Link: https://lore.kernel.org/r/20210818075742.1515155-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/intel/skylake/skl-pcm.c

index 7f287424af9b788035366546edaef7c9366260ef..439dd4ba690c4e07c3fa29b3ad009a53d3a3b5f5 100644 (file)
@@ -1333,21 +1333,6 @@ static int skl_get_module_info(struct skl_dev *skl,
                return -EIO;
        }
 
-       list_for_each_entry(module, &skl->uuid_list, list) {
-               if (guid_equal(uuid_mod, &module->uuid)) {
-                       mconfig->id.module_id = module->id;
-                       if (mconfig->module)
-                               mconfig->module->loadable = module->is_loadable;
-                       ret = 0;
-                       break;
-               }
-       }
-
-       if (ret)
-               return ret;
-
-       uuid_mod = &module->uuid;
-       ret = -EIO;
        for (i = 0; i < skl->nr_modules; i++) {
                skl_module = skl->modules[i];
                uuid_tplg = &skl_module->uuid;
@@ -1357,10 +1342,18 @@ static int skl_get_module_info(struct skl_dev *skl,
                        break;
                }
        }
+
        if (skl->nr_modules && ret)
                return ret;
 
+       ret = -EIO;
        list_for_each_entry(module, &skl->uuid_list, list) {
+               if (guid_equal(uuid_mod, &module->uuid)) {
+                       mconfig->id.module_id = module->id;
+                       mconfig->module->loadable = module->is_loadable;
+                       ret = 0;
+               }
+
                for (i = 0; i < MAX_IN_QUEUE; i++) {
                        pin_id = &mconfig->m_in_pin[i].id;
                        if (guid_equal(&pin_id->mod_uuid, &module->uuid))
@@ -1374,7 +1367,7 @@ static int skl_get_module_info(struct skl_dev *skl,
                }
        }
 
-       return 0;
+       return ret;
 }
 
 static int skl_populate_modules(struct skl_dev *skl)