summaryrefslogtreecommitdiff
path: root/drivers/base/firmware_loader/fallback.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-05-20 12:26:45 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-10 20:20:37 +0300
commit993f5d11a9631face2bb597826b86f476a9b915b (patch)
tree2f775376f5e409dc8e41e368ecdce8fdfdb20fb1 /drivers/base/firmware_loader/fallback.c
parent8f58570b98c090a4544ef9eaea1f419706672845 (diff)
downloadlinux-993f5d11a9631face2bb597826b86f476a9b915b.tar.xz
firmware: Use kvmalloc for page tables
This is a minor optimization to use kvmalloc() variant for allocating the page table for the SG-buffer. They aren't so big in general, so kmalloc() would fit often better. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_loader/fallback.c')
-rw-r--r--drivers/base/firmware_loader/fallback.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
index 8970a5315e85..b5cd96fd0e77 100644
--- a/drivers/base/firmware_loader/fallback.c
+++ b/drivers/base/firmware_loader/fallback.c
@@ -232,7 +232,7 @@ static int map_fw_priv_pages(struct fw_priv *fw_priv)
return -ENOMEM;
/* page table is no longer needed after mapping, let's free */
- vfree(fw_priv->pages);
+ kvfree(fw_priv->pages);
fw_priv->pages = NULL;
return 0;
@@ -397,7 +397,8 @@ static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size)
fw_priv->page_array_size * 2);
struct page **new_pages;
- new_pages = vmalloc(array_size(new_array_size, sizeof(void *)));
+ new_pages = kvmalloc_array(new_array_size, sizeof(void *),
+ GFP_KERNEL);
if (!new_pages) {
fw_load_abort(fw_sysfs);
return -ENOMEM;
@@ -406,7 +407,7 @@ static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size)
fw_priv->page_array_size * sizeof(void *));
memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) *
(new_array_size - fw_priv->page_array_size));
- vfree(fw_priv->pages);
+ kvfree(fw_priv->pages);
fw_priv->pages = new_pages;
fw_priv->page_array_size = new_array_size;
}