]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.111/dmaengine-imx-dma-fix-warning-comparison-of-distinct.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.111 / dmaengine-imx-dma-fix-warning-comparison-of-distinct.patch
CommitLineData
04fd09d4
SL
1From e840b32e4d094d7d2d5fb6f16c278355bce36a12 Mon Sep 17 00:00:00 2001
2From: Anders Roxell <anders.roxell@linaro.org>
3Date: Thu, 10 Jan 2019 12:15:35 +0100
4Subject: dmaengine: imx-dma: fix warning comparison of distinct pointer types
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9[ Upstream commit 9227ab5643cb8350449502dd9e3168a873ab0e3b ]
10
11The warning got introduced by commit 930507c18304 ("arm64: add basic
12Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
13haven't been seen before since size_t was 'unsigned int' when built on
14arm32.
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
33Rework so that we use min_t and pass in the size_t that returns the
34minimum of two values, using the specified type.
35
36Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
37Acked-by: Olof Johansson <olof@lixom.net>
38Reviewed-by: Fabio Estevam <festevam@gmail.com>
39Signed-off-by: Vinod Koul <vkoul@kernel.org>
40Signed-off-by: Sasha Levin <sashal@kernel.org>
41---
42 drivers/dma/imx-dma.c | 2 +-
43 1 file changed, 1 insertion(+), 1 deletion(-)
44
45diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
46index 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;
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--
592.19.1
60