Commit 72c35856 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mark Brown

ASoC: SOF: only allocate debugfs cache buffers for IPC flood entries

snd_sof_debugfs_buf_item() is an exported function and is called from
different locations to initialise different debugfs entries. However
.cache_buf is only needed for IPC flood entries. Limit allocations
respectively.
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarXiuli Pan <xiulipan@outlook.com>
Signed-off-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210315163932.18663-3-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 11fd6d8e
......@@ -609,14 +609,16 @@ int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev,
dfse->sdev = sdev;
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
/*
* cache_buf is unused for SOF_DFSENTRY_TYPE_BUF debugfs entries.
* So, use it to save the results of the last IPC flood test.
*/
dfse->cache_buf = devm_kzalloc(sdev->dev, IPC_FLOOD_TEST_RESULT_LEN,
GFP_KERNEL);
if (!dfse->cache_buf)
return -ENOMEM;
if (!strncmp(name, "ipc_flood", strlen("ipc_flood"))) {
/*
* cache_buf is unused for SOF_DFSENTRY_TYPE_BUF debugfs entries.
* So, use it to save the results of the last IPC flood test.
*/
dfse->cache_buf = devm_kzalloc(sdev->dev, IPC_FLOOD_TEST_RESULT_LEN,
GFP_KERNEL);
if (!dfse->cache_buf)
return -ENOMEM;
}
#endif
debugfs_create_file(name, mode, sdev->debugfs_root, dfse,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment