[PATCH 1/1] jffs2: remove unnecessary oom message
Zhen Lei
thunder.leizhen at huawei.com
Thu Jun 17 01:59:05 PDT 2021
Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message
Remove it can help us save a bit of memory.
Signed-off-by: Zhen Lei <thunder.leizhen at huawei.com>
---
fs/jffs2/compr.c | 16 +++++-----------
fs/jffs2/dir.c | 1 -
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c
index 4849a4c9a0e2..700a2de39b08 100644
--- a/fs/jffs2/compr.c
+++ b/fs/jffs2/compr.c
@@ -80,10 +80,8 @@ static int jffs2_selected_compress(u8 compr, unsigned char *data_in,
char *output_buf;
output_buf = kmalloc(*cdatalen, GFP_KERNEL);
- if (!output_buf) {
- pr_warn("No memory for compressor allocation. Compression failed.\n");
+ if (!output_buf)
return ret;
- }
orig_slen = *datalen;
orig_dlen = *cdatalen;
spin_lock(&jffs2_compressor_list_lock);
@@ -189,15 +187,11 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
spin_unlock(&jffs2_compressor_list_lock);
tmp_buf = kmalloc(orig_slen, GFP_KERNEL);
spin_lock(&jffs2_compressor_list_lock);
- if (!tmp_buf) {
- pr_warn("No memory for compressor allocation. (%d bytes)\n",
- orig_slen);
+ if (!tmp_buf)
continue;
- }
- else {
- this->compr_buf = tmp_buf;
- this->compr_buf_size = orig_slen;
- }
+
+ this->compr_buf = tmp_buf;
+ this->compr_buf_size = orig_slen;
}
this->usecount++;
spin_unlock(&jffs2_compressor_list_lock);
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index c0aabbcbfd58..a2f643dd1923 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -353,7 +353,6 @@ static int jffs2_symlink (struct user_namespace *mnt_userns, struct inode *dir_i
/* We use f->target field to store the target path. */
f->target = kmemdup(target, targetlen + 1, GFP_KERNEL);
if (!f->target) {
- pr_warn("Can't allocate %d bytes of memory\n", targetlen + 1);
mutex_unlock(&f->sem);
jffs2_complete_reservation(c);
ret = -ENOMEM;
--
2.25.1
More information about the linux-mtd
mailing list