diff options
author | Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> | 2016-01-22 18:11:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-22 20:02:18 -0500 |
commit | 1d5cfdb076288df5eb95545a547a39905e95c930 (patch) | |
tree | c644d2e609c3054833710b75ab1d0fe50fb17c01 /fs/udf | |
parent | eab95db69d334745d3034072f4a7204084136c88 (diff) |
tree wide: use kvfree() than conditional kfree()/vfree()
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-kernel@I-love.SAKURA.ne.jp>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Jan Kara <jack@suse.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Acked-by: David Rientjes <rientjes@google.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Boris Petkov <bp@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/super.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 0fbb4c7c72e8..a522c15a0bfd 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -279,17 +279,12 @@ static void udf_sb_free_bitmap(struct udf_bitmap *bitmap) | |||
279 | { | 279 | { |
280 | int i; | 280 | int i; |
281 | int nr_groups = bitmap->s_nr_groups; | 281 | int nr_groups = bitmap->s_nr_groups; |
282 | int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * | ||
283 | nr_groups); | ||
284 | 282 | ||
285 | for (i = 0; i < nr_groups; i++) | 283 | for (i = 0; i < nr_groups; i++) |
286 | if (bitmap->s_block_bitmap[i]) | 284 | if (bitmap->s_block_bitmap[i]) |
287 | brelse(bitmap->s_block_bitmap[i]); | 285 | brelse(bitmap->s_block_bitmap[i]); |
288 | 286 | ||
289 | if (size <= PAGE_SIZE) | 287 | kvfree(bitmap); |
290 | kfree(bitmap); | ||
291 | else | ||
292 | vfree(bitmap); | ||
293 | } | 288 | } |
294 | 289 | ||
295 | static void udf_free_partition(struct udf_part_map *map) | 290 | static void udf_free_partition(struct udf_part_map *map) |