From: Wolfgang Denk Date: Sun, 22 Feb 2009 21:16:21 +0100 Subject: [U-Boot] MIPS: Fix GCC-4.2 'discards qualifiers from pointer target type' warnings In-Reply-To: <49A0E17B.9090300@ruby.dti.ne.jp> References: <1233121463-25530-1-git-send-email-sr@denx.de> <200901281737.36571.sr@denx.de> <4982496B.80607@necel.com> <200901301122.05028.sr@denx.de> <49A0E17B.9090300@ruby.dti.ne.jp> Message-ID: <20090222201621.5907C832E43F@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Shinya Kuribayashi, In message <49A0E17B.9090300@ruby.dti.ne.jp> you wrote: > Compiling dbau1x00 and gth2 boards with GCC-4.2, you would see new warnings > like this: > > skuribay at ubuntu:u-boot.git$ ./MAKEALL dbau1000 > Configuring for dbau1x00 board... > au1x00_eth.c: In function 'au1x00_send': > au1x00_eth.c:158: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type > au1x00_eth.c: In function 'au1x00_recv': > au1x00_eth.c:211: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type > au1x00_eth.c: In function 'au1x00_init': > au1x00_eth.c:252: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type > au1x00_eth.c: In function 'au1x00_recv': > au1x00_eth.c:211: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type > au1x00_eth.c: In function 'au1x00_init': > au1x00_eth.c:252: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type > au1x00_eth.c: In function 'au1x00_send': > au1x00_eth.c:158: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type > > We're passing a volatile pointer to a function which is expecting a non- > volatile pointer. That's potentially dangerous, so gcc warns about it. > Confirmed with ELDK 4.2 (GCC 4.2.2) and Sourcey G++ 4.2 (GCC 4.2.3). > > To fix this, we add a volatile attribute to the argument in question. > The virt_to_phys function in Linux kernel also does the same thing. > > Signed-off-by: Stefan Roese > Signed-off-by: Shinya Kuribayashi > --- > Sorry for late reply, > > Stefan: I think this is a reasonable fix. I believe this works for ELDK > as well, of course. > > Walfgang: Please pick this up directly, thanks in advance. > > > include/asm-mips/io.h | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Applied, thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de God runs electromagnetics by wave theory on Monday, Wednesday, and Friday, and the Devil runs them by quantum theory on Tuesday, Thurs- day, and Saturday. -- William Bragg