]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
input: fix unaligned access in key_matrix_decode_fdt()
authorStephen Warren <swarren@nvidia.com>
Wed, 22 May 2013 08:48:18 +0000 (08:48 +0000)
committerTom Rini <trini@ti.com>
Tue, 4 Jun 2013 20:06:32 +0000 (16:06 -0400)
Initialized character arrays on the stack can cause gcc to emit code that
performs unaligned accessess. Make the data static to avoid this.

Note that the unaligned accesses are made when copying data to prefix[] on
the stack from .rodata. By making the data static, the copy is completely
avoided. All explicitly written code treats the data as u8[], so will never
cause any unaligned accesses.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/input/key_matrix.c

index 946a186a1ffaf2ad511cba5e0749efc53ddf8e16..c8b048e60455c96a18d0ec916df69313a858b800 100644 (file)
@@ -158,7 +158,7 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob,
                          int node)
 {
        const struct fdt_property *prop;
-       const char prefix[] = "linux,";
+       static const char prefix[] = "linux,";
        int plen = sizeof(prefix) - 1;
        int offset;