From 0b8fb21b5bfe60915007a30f4342c3df57dbf863 Mon Sep 17 00:00:00 2001 From: Soohyun Kim Date: Tue, 14 Oct 2014 21:46:05 +0900 Subject: [PATCH] dma: pl330: Remove unaligned access code If cpu has not allowed unaligned access, this code maybe has a problem. This patch is prevent above problem. Change-Id: I4df50f6e7079a32801ba749654f1c8930bc4d142 Signed-off-by: Soohyun Kim Signed-off-by: Seokju Yoon --- drivers/dma/pl330.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index b0b31f71ad9e..943168b03c5a 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -553,6 +553,11 @@ struct _xfer_spec { struct dma_pl330_desc *desc; }; +static inline u32 get_unaligned_le32(u8 *p) +{ + return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; +} + static inline bool _queue_full(struct pl330_thread *thrd) { return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL; @@ -892,7 +897,7 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd, } writel(val, regs + DBGINST0); - val = le32_to_cpu(*((__le32 *)&insn[2])); + val = get_unaligned_le32(&insn[2]); writel(val, regs + DBGINST1); /* If timed out due to halted state-machine */ -- 2.20.1