Skip to content

Commit

Permalink
Fix: Use module manifest from toml as a template for elf modules
Browse files Browse the repository at this point in the history
Some platforms (eg. tgl) dont have modules configuration in a toml files.
An attempt to use the configuration template ended with a reference to
a null pointer. This commit fixes this issue.

Signed-off-by: Adrian Warecki <[email protected]>
  • Loading branch information
softwarecki authored and lgirdwood committed Apr 6, 2023
1 parent 25804e7 commit ab0429f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,13 @@ static int man_create_modules(struct image *image, struct sof_man_fw_desc *desc,

for (; i < image->num_modules; i++) {
man_module = (void *)desc + SOF_MAN_MODULE_OFFSET(i - offset);
/* Use manifest created using toml files as template */
assert(i < image->adsp->modules->mod_man_count);
memcpy(man_module, &image->adsp->modules->mod_man[i], sizeof(*man_module));

/* Some platforms dont have modules configuration in toml file */
if (image->adsp->modules) {
/* Use manifest created using toml files as template */
assert(i < image->adsp->modules->mod_man_count);
memcpy(man_module, &image->adsp->modules->mod_man[i], sizeof(*man_module));
}

module = &image->module[i];

Expand Down
3 changes: 2 additions & 1 deletion src/rimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ int main(int argc, char *argv[])
goto out;
}

if (image.num_modules > image.adsp->modules->mod_man_count) {
/* Some platforms dont have modules configuration in toml file */
if (image.adsp->modules && image.num_modules > image.adsp->modules->mod_man_count) {
fprintf(stderr, "error: Each ELF input module requires entry in toml file.\n");
ret = -EINVAL;
goto out;
Expand Down

0 comments on commit ab0429f

Please sign in to comment.