diff options
author | Stephen Warren <swarren@nvidia.com> | 2013-05-22 08:48:18 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-06-04 16:06:32 -0400 |
commit | e573617c092eb49da2d67443725d755fca3e8b74 (patch) | |
tree | a85f9846d6b8e3b51a51b2ddfcaa7b74527f2443 | |
parent | b8521b740bdecfb18d43dda62d72cbf7e167f1d0 (diff) | |
download | u-boot-imx-e573617c092eb49da2d67443725d755fca3e8b74.zip u-boot-imx-e573617c092eb49da2d67443725d755fca3e8b74.tar.gz u-boot-imx-e573617c092eb49da2d67443725d755fca3e8b74.tar.bz2 |
input: fix unaligned access in key_matrix_decode_fdt()
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>
-rw-r--r-- | drivers/input/key_matrix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index 946a186..c8b048e 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -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; |