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 <yangjq@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1436053
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit c3499d1140811a8c1e8edfc3ef715170f8f98a1d)
Reviewed-on: https://gerrit.mot.com/1442611
Reviewed-by: Chuanchun Zhu <zhucc2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
yangjq 2019-10-12 18:28:49 +08:00 • committed by Weilong Wu
commit fb9df75ed8

View file

@ -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__);