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 /drivers/acpi | |
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 'drivers/acpi')
-rw-r--r-- | drivers/acpi/apei/erst.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 6682c5daf742..6e6bc1059301 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/hardirq.h> | 32 | #include <linux/hardirq.h> |
33 | #include <linux/pstore.h> | 33 | #include <linux/pstore.h> |
34 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
35 | #include <linux/mm.h> /* kvfree() */ | ||
35 | #include <acpi/apei.h> | 36 | #include <acpi/apei.h> |
36 | 37 | ||
37 | #include "apei-internal.h" | 38 | #include "apei-internal.h" |
@@ -532,10 +533,7 @@ retry: | |||
532 | return -ENOMEM; | 533 | return -ENOMEM; |
533 | memcpy(new_entries, entries, | 534 | memcpy(new_entries, entries, |
534 | erst_record_id_cache.len * sizeof(entries[0])); | 535 | erst_record_id_cache.len * sizeof(entries[0])); |
535 | if (erst_record_id_cache.size < PAGE_SIZE) | 536 | kvfree(entries); |
536 | kfree(entries); | ||
537 | else | ||
538 | vfree(entries); | ||
539 | erst_record_id_cache.entries = entries = new_entries; | 537 | erst_record_id_cache.entries = entries = new_entries; |
540 | erst_record_id_cache.size = new_size; | 538 | erst_record_id_cache.size = new_size; |
541 | } | 539 | } |