linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types
@ 2019-01-10 11:15 Anders Roxell
  2019-01-13 18:35 ` Olof Johansson
  2019-01-14 21:24 ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Anders Roxell @ 2019-01-10 11:15 UTC (permalink / raw)
  To: vkoul, dan.j.williams; +Cc: dmaengine, linux-kernel, Anders Roxell

The warning got introduced by commit 930507c18304 ("arm64: add basic
Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
haven't been seen before since size_t was 'unsigned int' when built on
arm32.

../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
   (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                             ^~
../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
   (__typecheck(x, y) && __no_side_effects(x, y))
    ^~~~~~~~~~~
../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
  __builtin_choose_expr(__safe_cmp(x, y), \
                        ^~~~~~~~~~
../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
 #define min(x, y) __careful_cmp(x, y, <)
                   ^~~~~~~~~~~~~
../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
  now = min(d->len, sg_dma_len(sg));
        ^~~

Rework so that we use min_t and pass in the size_t that returns the
minimum of two values, using the specified type.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/dma/imx-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index c2fff3f6c9ca..fa3ef43fe314 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -285,7 +285,7 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)
 	struct scatterlist *sg = d->sg;
 	unsigned long now;
 
-	now = min(d->len, sg_dma_len(sg));
+	now = min_t(size_t, d->len, sg_dma_len(sg));
 	if (d->len != IMX_DMA_LENGTH_LOOP)
 		d->len -= now;
 
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types
  2019-01-10 11:15 [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types Anders Roxell
@ 2019-01-13 18:35 ` Olof Johansson
  2019-01-14 21:24 ` Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: Olof Johansson @ 2019-01-13 18:35 UTC (permalink / raw)
  To: Anders Roxell
  Cc: Vinod Koul, Dan Williams, dmaengine, Linux Kernel Mailing List

On Thu, Jan 10, 2019 at 3:15 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> The warning got introduced by commit 930507c18304 ("arm64: add basic
> Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
> haven't been seen before since size_t was 'unsigned int' when built on
> arm32.
>
> ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
> ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
>    (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
>                              ^~
> ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
>    (__typecheck(x, y) && __no_side_effects(x, y))
>     ^~~~~~~~~~~
> ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
>   __builtin_choose_expr(__safe_cmp(x, y), \
>                         ^~~~~~~~~~
> ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
>  #define min(x, y) __careful_cmp(x, y, <)
>                    ^~~~~~~~~~~~~
> ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
>   now = min(d->len, sg_dma_len(sg));
>         ^~~
>
> Rework so that we use min_t and pass in the size_t that returns the
> minimum of two values, using the specified type.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

'now' should probably also be a size_t, but it can be done separately.
imxdma_sg_next()'s return value is never checked anywhere, so the
function can be changed to void as well.

That being said, I think this specific patch should go in now to keep
warnings out of our standard builds. The more we keep around, the
harder it is to spot when a new legitimate one shows up.

Acked-by: Olof Johansson <olof@lixom.net>


-Olof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types
  2019-01-10 11:15 [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types Anders Roxell
  2019-01-13 18:35 ` Olof Johansson
@ 2019-01-14 21:24 ` Fabio Estevam
  2019-01-15 14:14   ` Anders Roxell
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2019-01-14 21:24 UTC (permalink / raw)
  To: Anders Roxell; +Cc: Vinod, Dan Williams, dmaengine, linux-kernel

Hi Anders,

On Thu, Jan 10, 2019 at 9:15 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> The warning got introduced by commit 930507c18304 ("arm64: add basic
> Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
> haven't been seen before since size_t was 'unsigned int' when built on
> arm32.
>
> ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
> ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
>    (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
>                              ^~
> ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
>    (__typecheck(x, y) && __no_side_effects(x, y))
>     ^~~~~~~~~~~
> ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
>   __builtin_choose_expr(__safe_cmp(x, y), \
>                         ^~~~~~~~~~
> ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
>  #define min(x, y) __careful_cmp(x, y, <)
>                    ^~~~~~~~~~~~~
> ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
>   now = min(d->len, sg_dma_len(sg));
>         ^~~
>
> Rework so that we use min_t and pass in the size_t that returns the
> minimum of two values, using the specified type.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

There is a typo in the Subject: s/ixm/imx/ and the prefix should be
dmaengine instead:

dmaengine: imx-dma: fix warning comparison of distinct pointer types

With that fixed:

Reviewed-by: Fabio Estevam <festevam@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types
  2019-01-14 21:24 ` Fabio Estevam
@ 2019-01-15 14:14   ` Anders Roxell
  2019-01-20  5:46     ` Vinod Koul
  0 siblings, 1 reply; 5+ messages in thread
From: Anders Roxell @ 2019-01-15 14:14 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Vinod, Dan Williams, dmaengine, linux-kernel

On Mon, 14 Jan 2019 at 22:24, Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Anders,
>
> On Thu, Jan 10, 2019 at 9:15 AM Anders Roxell <anders.roxell@linaro.org> wrote:
> >
> > The warning got introduced by commit 930507c18304 ("arm64: add basic
> > Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
> > haven't been seen before since size_t was 'unsigned int' when built on
> > arm32.
> >
> > ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
> > ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
> >    (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
> >                              ^~
> > ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
> >    (__typecheck(x, y) && __no_side_effects(x, y))
> >     ^~~~~~~~~~~
> > ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
> >   __builtin_choose_expr(__safe_cmp(x, y), \
> >                         ^~~~~~~~~~
> > ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
> >  #define min(x, y) __careful_cmp(x, y, <)
> >                    ^~~~~~~~~~~~~
> > ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
> >   now = min(d->len, sg_dma_len(sg));
> >         ^~~
> >
> > Rework so that we use min_t and pass in the size_t that returns the
> > minimum of two values, using the specified type.
> >
> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>
> There is a typo in the Subject: s/ixm/imx/ and the prefix should be
> dmaengine instead:
>
> dmaengine: imx-dma: fix warning comparison of distinct pointer types
>
> With that fixed:
>
> Reviewed-by: Fabio Estevam <festevam@gmail.com>

OK, thanks Fabio.

Dan, do you want me to resend the patch with an updated shortlog or will
you do that when you apply the patch?

Cheers,
Anders

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types
  2019-01-15 14:14   ` Anders Roxell
@ 2019-01-20  5:46     ` Vinod Koul
  0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2019-01-20  5:46 UTC (permalink / raw)
  To: Anders Roxell; +Cc: Fabio Estevam, Dan Williams, dmaengine, linux-kernel

On 15-01-19, 15:14, Anders Roxell wrote:
> On Mon, 14 Jan 2019 at 22:24, Fabio Estevam <festevam@gmail.com> wrote:
> >
> > Hi Anders,
> >
> > On Thu, Jan 10, 2019 at 9:15 AM Anders Roxell <anders.roxell@linaro.org> wrote:
> > >
> > > The warning got introduced by commit 930507c18304 ("arm64: add basic
> > > Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning
> > > haven't been seen before since size_t was 'unsigned int' when built on
> > > arm32.
> > >
> > > ../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
> > > ../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
> > >    (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
> > >                              ^~
> > > ../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
> > >    (__typecheck(x, y) && __no_side_effects(x, y))
> > >     ^~~~~~~~~~~
> > > ../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
> > >   __builtin_choose_expr(__safe_cmp(x, y), \
> > >                         ^~~~~~~~~~
> > > ../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
> > >  #define min(x, y) __careful_cmp(x, y, <)
> > >                    ^~~~~~~~~~~~~
> > > ../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
> > >   now = min(d->len, sg_dma_len(sg));
> > >         ^~~
> > >
> > > Rework so that we use min_t and pass in the size_t that returns the
> > > minimum of two values, using the specified type.
> > >
> > > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> >
> > There is a typo in the Subject: s/ixm/imx/ and the prefix should be
> > dmaengine instead:
> >
> > dmaengine: imx-dma: fix warning comparison of distinct pointer types
> >
> > With that fixed:
> >
> > Reviewed-by: Fabio Estevam <festevam@gmail.com>
> 
> OK, thanks Fabio.
> 
> Dan, do you want me to resend the patch with an updated shortlog or will
> you do that when you apply the patch?

applied after fixing subsystem name and driver name

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-20  5:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 11:15 [PATCH] dma: ixm-dma: fix warning comparison of distinct pointer types Anders Roxell
2019-01-13 18:35 ` Olof Johansson
2019-01-14 21:24 ` Fabio Estevam
2019-01-15 14:14   ` Anders Roxell
2019-01-20  5:46     ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).