lkml.org 
[lkml]   [2015]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch for 4.0] x86: silence warning in /dev/mem support
On Thu 2015-04-16 12:09:54, Ingo Molnar wrote:
>
> * Pavel Machek <pavel@ucw.cz> wrote:
>
> > The compiler is right, the code is tricky, but it is also correct
> > AFAICT.
> >
> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> >
> > diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> > index fdf617c..8a8dce8 100644
> > --- a/arch/x86/mm/ioremap.c
> > +++ b/arch/x86/mm/ioremap.c
> > @@ -341,7 +341,7 @@ void *xlate_dev_mem_ptr(phys_addr_t phys)
> >
> > addr = (void __force *)ioremap_cache(start, PAGE_SIZE);
> > if (addr)
> > - addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
> > + addr = (void *)((unsigned long)addr | (unsigned long) (phys & ~PAGE_MASK));
>
> What warning did it generate and which compiler version?


CC arch/x86/mm/ioremap.o
arch/x86/mm/ioremap.c: In function ‘xlate_dev_mem_ptr’:
arch/x86/mm/ioremap.c:363:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
^
LD arch/x86/mm/built-in.o

pavel@amd:/data/l/linux$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2

(Patch should apply to today's 4.1-rc0, too).

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


\
 
 \ /
  Last update: 2015-04-16 12:21    [W:0.077 / U:2.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site