* [PATCH] ASoC: SOF: debug: delete sof_dfsentry_write()
@ 2022-07-06 7:28 Dan Carpenter
2022-07-06 8:41 ` Péter Ujfalusi
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-07-06 7:28 UTC (permalink / raw)
To: Pierre-Louis Bossart, Ranjani Sridharan
Cc: alsa-devel, Kai Vehmanen, kernel-janitors, Bard Liao,
Takashi Iwai, Peter Ujfalusi, Liam Girdwood, Fred Oh, Mark Brown,
Daniel Baluta, sound-open-firmware
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From review. Not tested.
sound/soc/sof/debug.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index c5d797e97c02..00abc2000bfb 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -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 */
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: SOF: debug: delete sof_dfsentry_write()
2022-07-06 7:28 [PATCH] ASoC: SOF: debug: delete sof_dfsentry_write() Dan Carpenter
@ 2022-07-06 8:41 ` Péter Ujfalusi
0 siblings, 0 replies; 2+ messages in thread
From: Péter Ujfalusi @ 2022-07-06 8:41 UTC (permalink / raw)
To: Dan Carpenter, Pierre-Louis Bossart, Ranjani Sridharan
Cc: alsa-devel, Kai Vehmanen, Daniel Baluta, kernel-janitors,
Takashi Iwai, Liam Girdwood, Fred Oh, Mark Brown, Bard Liao,
sound-open-firmware
Hi Dan,
On 06/07/2022 10:28, Dan Carpenter wrote:
> 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...
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From review. Not tested.
>
> sound/soc/sof/debug.c | 19 -------------------
> 1 file changed, 19 deletions(-)
>
> diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
> index c5d797e97c02..00abc2000bfb 100644
> --- a/sound/soc/sof/debug.c
> +++ b/sound/soc/sof/debug.c
> @@ -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,
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.
> };
>
> /* create FS entry for debug files that can expose DSP memories, registers */
--
Péter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-06 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-06 7:28 [PATCH] ASoC: SOF: debug: delete sof_dfsentry_write() Dan Carpenter
2022-07-06 8:41 ` Péter Ujfalusi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox