bcache: use kvfree() in various places
authorPekka Enberg <penberg@kernel.org>
Tue, 30 Jun 2015 21:59:30 +0000 (14:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jul 2015 02:45:00 +0000 (19:45 -0700)
Use kvfree() instead of open-coding it.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Cc: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/bcache/super.c
drivers/md/bcache/util.h

index 4dd2bb7167f05e94bda5d33b213dc67356fc9f5a..94980bfca43473c5ad141171300d71f6bd5cae55 100644 (file)
@@ -760,14 +760,8 @@ static void bcache_device_free(struct bcache_device *d)
        bio_split_pool_free(&d->bio_split_hook);
        if (d->bio_split)
                bioset_free(d->bio_split);
-       if (is_vmalloc_addr(d->full_dirty_stripes))
-               vfree(d->full_dirty_stripes);
-       else
-               kfree(d->full_dirty_stripes);
-       if (is_vmalloc_addr(d->stripe_sectors_dirty))
-               vfree(d->stripe_sectors_dirty);
-       else
-               kfree(d->stripe_sectors_dirty);
+       kvfree(d->full_dirty_stripes);
+       kvfree(d->stripe_sectors_dirty);
 
        closure_debug_destroy(&d->cl);
 }
index 98df7572b5f7f82b9091965e199a301159374bee..1d04c4859c70cba7339f6fe9bd10edd01ebe3ddb 100644 (file)
@@ -52,10 +52,7 @@ struct closure;
 
 #define free_heap(heap)                                                        \
 do {                                                                   \
-       if (is_vmalloc_addr((heap)->data))                              \
-               vfree((heap)->data);                                    \
-       else                                                            \
-               kfree((heap)->data);                                    \
+       kvfree((heap)->data);                                           \
        (heap)->data = NULL;                                            \
 } while (0)
 
@@ -163,10 +160,7 @@ do {                                                                       \
 
 #define free_fifo(fifo)                                                        \
 do {                                                                   \
-       if (is_vmalloc_addr((fifo)->data))                              \
-               vfree((fifo)->data);                                    \
-       else                                                            \
-               kfree((fifo)->data);                                    \
+       kvfree((fifo)->data);                                           \
        (fifo)->data = NULL;                                            \
 } while (0)