Use vmalloc not kmalloc to avoid allocation fail
kerSysBcmSpiSlaveWriteBuf allocates more than 64kB at a time. This
previously caused some out-of-memory errors. Let's use vmalloc instead.
Change-Id: I06eb7e6a3c5f65e959b4b1258e78bfe931a27c09
diff --git a/bbsi.h b/bbsi.h
index 875c52d..7907864 100644
--- a/bbsi.h
+++ b/bbsi.h
@@ -19,6 +19,7 @@
#include <linux/netdevice.h>
#include <linux/spi/spi.h>
+#include <linux/vmalloc.h>
#ifndef KSEG1
#define KSEG1 0 // just to appease non-MIPS CPUs. Not really used.
@@ -260,7 +261,7 @@
return;
}
- t = kmalloc(nelems * sizeof(struct spi_transfer) * 2, GFP_KERNEL);
+ t = vmalloc(nelems * sizeof(struct spi_transfer) * 2);
if (!t) {
pr_warn("spi writebuf: out of memory\n");
return;
@@ -291,7 +292,7 @@
__pollstatus(spi);
spi_bus_unlock(spi->master);
- kfree(t);
+ vfree(t);
}
#endif // __BBSI_H