dma: pl330: Remove unaligned access code
authorSoohyun Kim <soohyuni.kim@samsung.com>
Tue, 14 Oct 2014 12:46:05 +0000 (21:46 +0900)
committerTaekki Kim <taekki.kim@samsung.com>
Mon, 14 May 2018 05:42:46 +0000 (14:42 +0900)
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 <soohyuni.kim@samsung.com>
Signed-off-by: Seokju Yoon <sukju.yoon@samsung.com>
drivers/dma/pl330.c

index b0b31f71ad9e2732e137490123d8a336cc212776..943168b03c5a7c457e12281a139c254be590a1a5 100644 (file)
@@ -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 */