From 57920628ebe51080f116a2d4700daefd2ca5b927 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Sun, 16 Dec 2018 15:18:09 -0600 Subject: [PATCH 1/2] ASoC: SOF: nocodec: don't free memory allocated with devm_kzalloc Detected with Coccinelle sound/soc/sof/nocodec.c:46:2-7: WARNING: invalid free of devm_ allocated data Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/nocodec.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c index e8b28b12051a00..4bb6a74093336d 100644 --- a/sound/soc/sof/nocodec.c +++ b/sound/soc/sof/nocodec.c @@ -23,7 +23,7 @@ int sof_nocodec_setup(struct device *dev, const struct snd_sof_dsp_ops *ops) { struct snd_soc_dai_link *links; - int ret; + int ret = 0; if (!mach) return -EINVAL; @@ -42,12 +42,7 @@ int sof_nocodec_setup(struct device *dev, ret = sof_bes_setup(dev, ops, links, ops->num_drv, &sof_nocodec_card); - if (ret) { - kfree(links); - return ret; - } - - return 0; + return ret; } EXPORT_SYMBOL(sof_nocodec_setup); From 69b4a6987ae60f9ab067a36b1d5953b3fc26ae97 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Sun, 16 Dec 2018 15:22:31 -0600 Subject: [PATCH 2/2] ASoC: SOF: debug: use simple_open() Detected with Coccinelle sound/soc/sof/debug.c:19:11-28: WARNING opportunity for simple_open, see also structure on line 82 Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/debug.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index 5722346f954d8d..375a8e3d04cfe9 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -16,13 +16,6 @@ #include #include "sof-priv.h" -static int sof_dfsentry_open(struct inode *inode, struct file *file) -{ - file->private_data = inode->i_private; - - return 0; -} - static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { @@ -79,7 +72,7 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer, } static const struct file_operations sof_dfs_fops = { - .open = sof_dfsentry_open, + .open = simple_open, .read = sof_dfsentry_read, .llseek = default_llseek, };