tools: ffs-test: fix header values endianess
authorMichal Nazarewicz <mina86@mina86.com>
Fri, 13 Jun 2014 13:38:05 +0000 (15:38 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 6 Aug 2014 17:07:33 +0000 (18:07 +0100)
commit f35f71244da6e51db4e1f2c7e318581f498ececf upstream.

It appears that no one ever run ffs-test on a big-endian machine,
since it used cpu-endianess for fs_count and hs_count fields which
should be in little-endian format.  Fix by wrapping the numbers in
cpu_to_le32.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
tools/usb/ffs-test.c

index f17dfee..726af27 100644 (file)
@@ -143,8 +143,8 @@ static const struct {
        .header = {
                .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
                .length = cpu_to_le32(sizeof descriptors),
-               .fs_count = 3,
-               .hs_count = 3,
+               .fs_count = cpu_to_le32(3),
+               .hs_count = cpu_to_le32(3),
        },
        .fs_descs = {
                .intf = {