[U-Boot] [PATCH 1/6] usb:gadget:ums: Replace malloc calls with memalign to fix cache buffer alignment
Lukasz Majewski
l.majewski at samsung.com
Fri Jan 31 13:16:24 CET 2014
Calls to malloc() have been replaced by memalign. It provides proper
buffer alignment.
Change-Id: Iffcf42082a125f848124bc84d1a95353493798a4
Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
Cc: Marek Vasut <marex at denx.de>
---
drivers/usb/gadget/f_mass_storage.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index b1fe8bd..f896169 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2515,7 +2515,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
buffhds_first_it:
bh->inreq_busy = 0;
bh->outreq_busy = 0;
- bh->buf = kmalloc(FSG_BUFLEN, GFP_KERNEL);
+ bh->buf = memalign(CONFIG_SYS_CACHELINE_SIZE, FSG_BUFLEN);
if (unlikely(!bh->buf)) {
rc = -ENOMEM;
goto error_release;
@@ -2622,7 +2622,7 @@ usb_copy_descriptors(struct usb_descriptor_header **src)
bytes += (*tmp)->bLength;
bytes += (n_desc + 1) * sizeof(*tmp);
- mem = kmalloc(bytes, GFP_KERNEL);
+ mem = memalign(CONFIG_SYS_CACHELINE_SIZE, bytes);
if (!mem)
return NULL;
--
1.7.10.4
More information about the U-Boot
mailing list