Re: [PATCH 25/30] dmaengine: s3c24xx: fix pointer cast warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 17, 2016 at 08:49:51PM +0200, Krzysztof Kozlowski wrote:
> On Fri, Sep 16, 2016 at 04:05:22PM +0200, Arnd Bergmann wrote:
> > On Friday, September 16, 2016 2:51:22 PM CEST Krzysztof Kozlowski wrote:
> > > > diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c
> > > > index b4a7041c4f81..2ec47478110b 100644
> > > > --- a/drivers/dma/s3c24xx-dma.c
> > > > +++ b/drivers/dma/s3c24xx-dma.c
> > > > @@ -1418,7 +1418,7 @@ bool s3c24xx_dma_filter(struct dma_chan *chan, void *param)
> > > >  
> > > >       s3cchan = to_s3c24xx_dma_chan(chan);
> > > >  
> > > > -     return s3cchan->id == (int)param;
> > > > +     return s3cchan->id == (long)param;
> > > 
> > > The 'id' is an int so the cast might trick someone to think it is an
> > > long. Also commit message suggests that the over-size cast issue is
> > > fixed... but it is not. If the ID > INT_MAX then the problem will
> > > silently occur. It does not look like a real issue but how about fixing
> > > it completely by switching 'id' to long?
> > 
> > This is about compile-testing on 64-bit architectures, where a cast from
> > pointer to 'int' causes a warning. I think the intention would be clearer
> > if using
> > 
> > 	return s3cchan->id == (uintptr_t)param;
> 
> I like it. Fixes the warning and the cast is obvious.

Its better one, so I am folding it up..

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux