From fb9df75ed88f1d861623d6956008158e8bfd8384 Mon Sep 17 00:00:00 2001 From: yangjq Date: Sat, 12 Oct 2019 18:28:49 +0800 Subject: [PATCH] aw8695: Use vzalloc instead of kzalloc Sometimes memory is scarce, especially those continuous memory, so use vzalloc to have more chance to allocate memory successfully. Change-Id: I374d9009092701ba1c3d609ad05271af0739fd35 Signed-off-by: yangjq Reviewed-on: https://gerrit.mot.com/1436053 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key (cherry picked from commit c3499d1140811a8c1e8edfc3ef715170f8f98a1d) Reviewed-on: https://gerrit.mot.com/1442611 Reviewed-by: Chuanchun Zhu Reviewed-by: Huosheng Liao --- drivers/misc/awinic/aw8695/aw8695.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/misc/awinic/aw8695/aw8695.c b/drivers/misc/awinic/aw8695/aw8695.c index e1cf4d2b1aa9..6ebbcc3db4ef 100644 --- a/drivers/misc/awinic/aw8695/aw8695.c +++ b/drivers/misc/awinic/aw8695/aw8695.c @@ -227,7 +227,7 @@ static void aw8695_rtp_loaded(const struct firmware *cont, void *context) cont ? cont->size : 0); /* aw8695 rtp update */ - aw8695_rtp = kzalloc(cont->size + sizeof(int), GFP_KERNEL); + aw8695_rtp = vzalloc(cont->size + sizeof(int)); if (!aw8695_rtp) { release_firmware(cont); pr_err("%s: Error allocating memory\n", __func__); @@ -1188,8 +1188,8 @@ static void aw8695_rtp_work_routine(struct work_struct *work) return ; } aw8695->rtp_init = 0; - kfree(aw8695_rtp); - aw8695_rtp = kzalloc(rtp_file->size + sizeof(int), GFP_KERNEL); + vfree(aw8695_rtp); + aw8695_rtp = vzalloc(rtp_file->size + sizeof(int)); if (!aw8695_rtp) { release_firmware(rtp_file); pr_err("%s: error allocating memory\n", __func__);