1 From e840b32e4d094d7d2d5fb6f16c278355bce36a12 Mon Sep 17 00:00:00 2001
2 From: Anders Roxell <anders.roxell@linaro.org>
3 Date: Thu, 10 Jan 2019 12:15:35 +0100
4 Subject: dmaengine: imx-dma: fix warning comparison of distinct pointer types
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 [ Upstream commit 9227ab5643cb8350449502dd9e3168a873ab0e3b ]
11 The warning got introduced by commit 930507c18304 ("arm64: add basic
12 Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
13 haven't been seen before since size_t was 'unsigned int' when built on
16 ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
17 ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
18 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
20 ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
21 (__typecheck(x, y) && __no_side_effects(x, y))
23 ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
24 __builtin_choose_expr(__safe_cmp(x, y), \
26 ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
27 #define min(x, y) __careful_cmp(x, y, <)
29 ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
30 now = min(d->len, sg_dma_len(sg));
33 Rework so that we use min_t and pass in the size_t that returns the
34 minimum of two values, using the specified type.
36 Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
37 Acked-by: Olof Johansson <olof@lixom.net>
38 Reviewed-by: Fabio Estevam <festevam@gmail.com>
39 Signed-off-by: Vinod Koul <vkoul@kernel.org>
40 Signed-off-by: Sasha Levin <sashal@kernel.org>
42 drivers/dma/imx-dma.c | 2 +-
43 1 file changed, 1 insertion(+), 1 deletion(-)
45 diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
46 index cb37730f9272..6eb1f05f7c3c 100644
47 --- a/drivers/dma/imx-dma.c
48 +++ b/drivers/dma/imx-dma.c
49 @@ -290,7 +290,7 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)
50 struct scatterlist *sg = d->sg;
53 - now = min(d->len, sg_dma_len(sg));
54 + now = min_t(size_t, d->len, sg_dma_len(sg));
55 if (d->len != IMX_DMA_LENGTH_LOOP)