]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.34/dmaengine-imx-dma-fix-warning-comparison-of-distinct.patch
Linux 4.19.34
[thirdparty/kernel/stable-queue.git] / releases / 4.19.34 / dmaengine-imx-dma-fix-warning-comparison-of-distinct.patch
1 From 5f36c494f89d6bb3ecb545e9765b00f206ed7ec3 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
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 [ Upstream commit 9227ab5643cb8350449502dd9e3168a873ab0e3b ]
10
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
14 arm32.
15
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)))
19 ^~
20 ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
21 (__typecheck(x, y) && __no_side_effects(x, y))
22 ^~~~~~~~~~~
23 ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
24 __builtin_choose_expr(__safe_cmp(x, y), \
25 ^~~~~~~~~~
26 ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
27 #define min(x, y) __careful_cmp(x, y, <)
28 ^~~~~~~~~~~~~
29 ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
30 now = min(d->len, sg_dma_len(sg));
31 ^~~
32
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.
35
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>
41 ---
42 drivers/dma/imx-dma.c | 2 +-
43 1 file changed, 1 insertion(+), 1 deletion(-)
44
45 diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
46 index 118d371a2a4a..dfee0d895ce3 100644
47 --- a/drivers/dma/imx-dma.c
48 +++ b/drivers/dma/imx-dma.c
49 @@ -284,7 +284,7 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)
50 struct scatterlist *sg = d->sg;
51 unsigned long now;
52
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)
56 d->len -= now;
57
58 --
59 2.19.1
60