ASoC: SOF: debug: delete sof_dfsentry_write()
Subsystems (4)
PATCH 1/1 ASoC: SOF: debug: delete sof_dfsentry_write()
The sof_dfsentry_write() function used to have a purpose but now it is a no-op. It allocates a zeroed buffer, copies at least one byte of data to it, and then frees it without doing anything. Just delete the function.
---
From review. Not tested.
sound/soc/sof/debug.c | 19 ------------------- 1 file changed, 19 deletions(-)
sound/soc/sof/debug.c +0 -19
@@ -19,24 +19,6 @@#include "sof-priv.h" #include "ops.h" -static ssize_t sof_dfsentry_write (struct file *file,const char __user *buffer, -size_t count,loff_t *ppos) -{ -size_t size; -char *string; -int ret; - - string =kzalloc (count+1 ,GFP_KERNEL ); -if (!string) -return -ENOMEM ; - - size =simple_write_to_buffer (string, count, ppos, buffer, count); - ret = size; - -kfree (string); -return ret; -} -static ssize_t sof_dfsentry_read (struct file *file,char __user *buffer,size_t count,loff_t *ppos) {
@@ -126,7 +108,6 @@ static const struct file_operations sof_dfs_fops = { .open = simple_open, .read = sof_dfsentry_read, .llseek = default_llseek, - .write = sof_dfsentry_write, };/* create FS entry for debug files that can expose DSP memories, registers */
Signature · 1 line
2.35.1
Péter Ujfalusi
maintainerHi Dan,
Quoted 6 lines · Dan Carpenter
The
sof_dfsentry_write()function used to have a purpose but now it is a no-op. It allocates a zeroed buffer, copies at least one byte of data to it, and then frees it without doing anything. Just delete the function.Fixes 6e9548cdb30e ("ASoC: SOF: Convert the generic IPC flood test into SOF client")
it is not really a fix but rather complements that commit...
Quoted 37 lines
Signed-off-by Dan Carpenter <[email protected]>---
From review. Not tested.sound/soc/sof/debug.c | 19 ------------------- 1 file changed, 19 deletions(-)sound/soc/sof/debug.c +0
-18@@ -19,24 +19,6 @@#include "sof-priv.h" #include "ops.h" -static ssize_t sof_dfsentry_write (struct file *file,const char __user *buffer, -size_t count,loff_t *ppos) -{ -size_t size; -char *string; -int ret; - - string =kzalloc (count+1 ,GFP_KERNEL ); -if (!string) -return -ENOMEM ; - - size =simple_write_to_buffer (string, count, ppos, buffer, count); - ret = size; - -kfree (string); -return ret; -} -static ssize_t sof_dfsentry_read (struct file *file,char __user *buffer,size_t count,loff_t *ppos) {
sound/soc/sof/debug.c static const struct file_operations sof_dfs_fops = { · line 129
Quoted 4 lines
sound/soc/sof/debug.c +0
-1@@ -126,7 +108,6 @@ static const struct file_operations sof_dfs_fops = { .open = simple_open, .read = sof_dfsentry_read, .llseek = default_llseek, - .write = sof_dfsentry_write,
I might add a check in snd_sof_debugfs_buf_item() to disallow write permission for the file. I know, we only use 0444 for the remaining files. It might be too paranoid, I guess.
Quoted 3 lines
sound/soc/sof/debug.c +0
-0};/* create FS entry for debug files that can expose DSP memories, registers */
Signature · 1 line
Péter