From: Guennadi Liakhovetski Date: Mon, 15 Mar 2021 16:39:31 +0000 (-0500) Subject: ASoC: SOF: only allocate debugfs cache buffers for IPC flood entries X-Git-Tag: accepted/tizen/unified/20230118.172025~7091^2~1^2~174^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72c35856b5edc3f734be5699e9f6737190a1d897;p=platform%2Fkernel%2Flinux-rpi.git 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: Ranjani Sridharan Reviewed-by: Xiuli Pan Signed-off-by: Guennadi Liakhovetski Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20210315163932.18663-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index 715a374..778c7d0 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -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,