Skip to content

Commit b32487c

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: debug: Handle cases when fw_lib_prefix is not set, NULL
The firmware libraries are not supported by IPC3, the fw_lib_path is not a valid parameter and it is always NULL. Do not create the debugfs file for IPC3 at all as it is not applicable. With IPC4 some vendors/platforms might not support loadable libraries and the fw_lib_prefix is left to NULL to indicate this. Handle such case with allocating "Not supported" string. Reviewed-by: Marc Herbert <[email protected]> Fixes: 17f4041 ("ASoC: SOF: debug: show firmware/topology prefix/names") Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9b4f416 commit b32487c

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

sound/soc/sof/debug.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,27 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev)
326326

327327
debugfs_create_str("fw_path", 0444, fw_profile,
328328
(char **)&plat_data->fw_filename_prefix);
329-
debugfs_create_str("fw_lib_path", 0444, fw_profile,
330-
(char **)&plat_data->fw_lib_prefix);
329+
/* library path is not valid for IPC3 */
330+
if (plat_data->ipc_type != SOF_IPC_TYPE_3) {
331+
/*
332+
* fw_lib_prefix can be NULL if the vendor/platform does not
333+
* support loadable libraries
334+
*/
335+
if (plat_data->fw_lib_prefix) {
336+
debugfs_create_str("fw_lib_path", 0444, fw_profile,
337+
(char **)&plat_data->fw_lib_prefix);
338+
} else {
339+
static char *fw_lib_path;
340+
341+
fw_lib_path = devm_kasprintf(sdev->dev, GFP_KERNEL,
342+
"Not supported");
343+
if (!fw_lib_path)
344+
return -ENOMEM;
345+
346+
debugfs_create_str("fw_lib_path", 0444, fw_profile,
347+
(char **)&fw_lib_path);
348+
}
349+
}
331350
debugfs_create_str("tplg_path", 0444, fw_profile,
332351
(char **)&plat_data->tplg_filename_prefix);
333352
debugfs_create_str("fw_name", 0444, fw_profile,

0 commit comments

Comments
 (0)