From: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> There are many locations that do
if (memory_was_allocated_by_vmalloc) vfree(ptr); else kfree(ptr); but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory using is_vmalloc_addr(). Unless callers have special reasons, we can replace this branch with kvfree(). Please check and reply if you found problems. Signed-off-by: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> Acked-by: Michal Hocko <mho...@suse.com> Acked-by: Jan Kara <j...@suse.com> Acked-by: Russell King <rmk+ker...@arm.linux.org.uk> Reviewed-by: Andreas Dilger <andreas.dil...@intel.com> Acked-by: "Rafael J. Wysocki" <r...@rjwysocki.net> Acked-by: David Rientjes <rient...@google.com> Cc: "Luck, Tony" <tony.l...@intel.com> Cc: Oleg Drokin <oleg.dro...@intel.com> Cc: Boris Petkov <b...@suse.de> Signed-off-by: Andrew Morton <a...@linux-foundation.org> Signed-off-by: Linus Torvalds <torva...@linux-foundation.org> 0 0 cpukit/libfs/src/jffs2/include/linux/mm.h 1 0 cpukit/libfs/src/jffs2/include/linux/slab.h 2 6 cpukit/libfs/src/jffs2/src/build.c diff --git a/cpukit/libfs/src/jffs2/include/linux/mm.h b/cpukit/libfs/src/jffs2/include/linux/mm.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cpukit/libfs/src/jffs2/include/linux/slab.h b/cpukit/libfs/src/jffs2/include/linux/slab.h index 00ddbb274a..532586e210 100644 --- a/cpukit/libfs/src/jffs2/include/linux/slab.h +++ b/cpukit/libfs/src/jffs2/include/linux/slab.h @@ -8,6 +8,7 @@ #define kzalloc(x, y) calloc(1, x) #define kmalloc(x, y) malloc(x) #define kfree(x) free(x) +#define kvfree(x) free(x) #define vmalloc(x) malloc(x) #define vfree(x) free(x) diff --git a/cpukit/libfs/src/jffs2/src/build.c b/cpukit/libfs/src/jffs2/src/build.c index b16f2c9fe7..cbc424283c 100644 --- a/cpukit/libfs/src/jffs2/src/build.c +++ b/cpukit/libfs/src/jffs2/src/build.c @@ -19,6 +19,7 @@ #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/mtd/mtd.h> +#include <linux/mm.h> /* kvfree() */ #include "nodelist.h" static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *, @@ -385,12 +386,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) return 0; out_free: -#ifndef __ECOS - if (jffs2_blocks_use_vmalloc(c)) - vfree(c->blocks); - else -#endif - kfree(c->blocks); + kvfree(c->blocks); return ret; } -- 2.13.7 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel