[U-Boot] [PATCH 1/6] usb:gadget:ums: Replace malloc calls with memalign to fix cache buffer alignment

Lukasz Majewski
2014-02-01T09:10:51Z

On Sat, 1 Feb 2014 03:48:57 +0100
Marek Vasut <marex@denx.de> wrote:
Hi Marek,

> On Friday, January 31, 2014 at 01:16:24 PM, Lukasz Majewski wrote:
> > Calls to malloc() have been replaced by memalign. It provides proper
> > buffer alignment.
> >
> > Change-Id: Iffcf42082a125f848124bc84d1a95353493798a4
>
> ^ Where does this Change-Id come from ?

This comes from our internal Gerrit. By my mistake I've forgotten to
remove it from a commit.

I will remove it from the commit in the next patch version.

>
> > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> > Cc: Marek Vasut <marex@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;
>
> Best regards,
> Marek Vasut
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Best regards,
Lukasz Majewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140201/0106c645/attachment.pgp>