sound: soc: codec: rt5677: Use vmalloc instead of kzalloc

We don't needs that the memory for the sound model or microphone buffer
be contiguous, so we can use vmalloc which should prevent spurious
failed allocs.

BUG=22940183

Change-Id: I905591220676391f9a1e245309744ee3bc715ee5
Signed-off-by: Chris Thornton <thorntonc@google.com>
(cherry picked from commit 4205d2c97bc193eff1388b1d7c1d68f1ac755418)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 3d32d11..bf5abbe 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -22,6 +22,7 @@
 #include <linux/of_gpio.h>
 #include <linux/elf.h>
 #include <linux/firmware.h>
+#include <linux/vmalloc.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -5025,7 +5026,7 @@
 	rt5677->mbist_test = false;
 	rt5677->vad_sleep = true;
 	rt5677->mic_buf_len = RT5677_PRIV_MIC_BUF_SIZE;
-	rt5677->mic_buf = kmalloc(rt5677->mic_buf_len, GFP_KERNEL);
+	rt5677->mic_buf = vmalloc(rt5677->mic_buf_len);
 	if (NULL == rt5677->mic_buf) {
 		kfree(rt5677);
 		return -ENOMEM;
@@ -5082,8 +5083,8 @@
 	struct rt5677_priv *rt5677 = i2c_get_clientdata(i2c);
 
 	snd_soc_unregister_codec(&i2c->dev);
-	kfree(rt5677->mic_buf);
-	kfree(rt5677->model_buf);
+	vfree(rt5677->mic_buf);
+	vfree(rt5677->model_buf);
 	kfree(rt5677);
 	return 0;
 }
diff --git a/sound/soc/codecs/rt5677_ioctl.c b/sound/soc/codecs/rt5677_ioctl.c
index 1c156c2..f5ee880 100644
--- a/sound/soc/codecs/rt5677_ioctl.c
+++ b/sound/soc/codecs/rt5677_ioctl.c
@@ -10,6 +10,7 @@
  */
 
 #include <linux/spi/spi.h>
+#include <linux/vmalloc.h>
 #include <sound/soc.h>
 #include "rt_codec_ioctl.h"
 #include "rt5677_ioctl.h"
@@ -151,9 +152,9 @@
 	case RT_WRITE_CODEC_DSP_IOCTL:
 	case RT_WRITE_CODEC_DSP_IOCTL_COMPAT:
 		if (!rt5677->model_buf || rt5677->model_len < size) {
-			kfree(rt5677->model_buf);
+			vfree(rt5677->model_buf);
 			rt5677->model_len = 0;
-			rt5677->model_buf = kzalloc(size, GFP_KERNEL);
+			rt5677->model_buf = vmalloc(size);
 			if (!rt5677->model_buf)
 				return -ENOMEM;
 		}