drivers/net/e1000_spi.c: Fix build warnings
PATCH 1/1 drivers/net/e1000_spi.c: Fix build warnings
Fix:e1000_spi.c: In function 'spi_free_slave':
e1000_spi.c:115: warning: unused variable 'hw'e1000_spi.c: In function 'do_e1000_spi':
e1000_spi.c:472: warning: 'checksum' may be used uninitialized in this function e1000_spi.c:472: note: 'checksum' was declared here
--- drivers/net/e1000_spi.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/e1000_spi.c +3 -2
@@ -1,4 +1,5 @@#include "e1000.h" +#include <linux/compiler.h> /*----------------------------------------------------------------------- * SPI transfer
@@ -112,7 +113,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,void spi_free_slave (struct spi_slave *spi) { -struct e1000_hw *hw =e1000_hw_from_spi (spi); +__maybe_unused struct e1000_hw *hw =e1000_hw_from_spi (spi);E1000_DBG (hw->nic,"EEPROM SPI access released\n" ); }
@@ -469,7 +470,7 @@ static int do_e1000_spi_program(cmd_tbl_t *cmdtp, struct e1000_hw *hw,static int do_e1000_spi_checksum (cmd_tbl_t *cmdtp,struct e1000_hw *hw,int argc,char *const argv[]) { -uint16_t i, length, checksum, checksum_reg; +uint16_t i, length, checksum =0 , checksum_reg;uint16_t *buffer;boolean_t upd;
Signature · 1 line
1.7.5.4
Moffett
PATCH 1/1 drivers/net/e1000_spi.c: Fix build warnings
Quoted 6 lines · Anatolij Gustschin
Fix:
e1000_spi.c: In function 'spi_free_slave':
e1000_spi.c:115: warning: unused variable 'hw'e1000_spi.c: In function 'do_e1000_spi':
e1000_spi.c:472: warning: 'checksum' may be used uninitialized in this function e1000_spi.c:472: note: 'checksum' was declared here
This is great, thanks!
I actually thought that the "checksum" fix had already made it into Wolfgang's tree, but I can't find it now that I'm looking for it.
The really frustrating thing is that on my test system I have seen the "unused variable" warning for a while now (although I was not sure what to do about it), but despite the fact that the "checksum" variable is very clearly improperly initialized I don't get that warning out of my compiler.
Oh, right, I'm using GCC 4.4 right now and it needs 4.6+
Ironically enough, I have never had the checksum computation produce an incorrect result, Linux always thinks the result is correct. It must always get a zero in that register somehow.
Cheers,
Kyle Moffett
Quoted 33 lines
Signed-off-by Anatolij Gustschin <[email protected]>Cc Kyle Moffett <[email protected]>---
drivers/net/e1000_spi.c| 5 +++--1 files changed, 3 insertions(+), 2 deletions(-)drivers/net/e1000_spi.c +3
-2@@ -1,4 +1,5 @@#include "e1000.h" +#include <linux/compiler.h> /*----------------------------------------------------------------------- * SPI transfer @@ -112,7 +113,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,void spi_free_slave (struct spi_slave *spi) { -struct e1000_hw *hw =e1000_hw_from_spi (spi); +__maybe_unused struct e1000_hw *hw =e1000_hw_from_spi (spi);E1000_DBG (hw->nic,"EEPROM SPI access released\n" ); }@@ -469,7 +470,7 @@ static int do_e1000_spi_program(cmd_tbl_t *cmdtp, struct e1000_hw *hw,static int do_e1000_spi_checksum (cmd_tbl_t *cmdtp,struct e1000_hw *hw,int argc,char *const argv[]) { -uint16_t i, length, checksum, checksum_reg; +uint16_t i, length, checksum =0 , checksum_reg;uint16_t *buffer;boolean_t upd;
PATCH 1/1 drivers/net/e1000_spi.c: Fix build warnings
Quoted 8 lines · Kyle D
Quoted 6 lines · Anatolij Gustschin
Fix:
e1000_spi.c: In function 'spi_free_slave':
e1000_spi.c:115: warning: unused variable 'hw'e1000_spi.c: In function 'do_e1000_spi':
e1000_spi.c:472: warning: 'checksum' may be used uninitialized in this function e1000_spi.c:472: note: 'checksum' was declared here
Quoted 7 lines
Acked-by Kyle Moffett <[email protected]>This is great, thanks!
I actually thought that the "checksum" fix had already made it into Wolfgang's tree, but I can't find it now that I'm looking for it.
There is a "checksum" fix in Wolfgang's tree, commit 7a341066 (e1000: fix bugs from recent commits). It is for drivers/net/e1000.c file, however.
Quoted 7 lines
The really frustrating thing is that on my test system I have seen the "unused variable" warning for a while now (although I was not sure what to do about it), but despite the fact that the "checksum" variable is very clearly improperly initialized I don't get that warning out of my compiler.
Oh, right, I'm using GCC 4.4 right now and it needs 4.6+
I've seen this warning with GCC 4.2.2 and GCC 4.6.1.
Thanks,
Anatolij
PATCH 1/1 drivers/net/e1000_spi.c: Fix build warnings
In reply to Anatolij Gustschindrivers/net/e1000_spi.c struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, · line 117
Quoted 3 lines · On Tuesday 20 December 2011 07:29:03 Anatolij Gustschin wrote:
drivers/net/e1000_spi.c +1
-1-struct e1000_hw *hw =e1000_hw_from_spi (spi); +__maybe_unused struct e1000_hw *hw =e1000_hw_from_spi (spi);E1000_DBG (hw->nic,"EEPROM SPI access released\n" );
fix the E1000_DBG() macro to use debug() instead
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111220/68612fb4/attachment.pgp>
Wolfgang Denk
AppliedPATCH 1/1 drivers/net/e1000_spi.c: Fix build warnings
In reply to Anatolij GustschinDear Anatolij Gustschin,
Quoted 7 lines · In message <[email protected]> you wrote:
Fix:
e1000_spi.c: In function 'spi_free_slave':
e1000_spi.c:115: warning: unused variable 'hw'e1000_spi.c: In function 'do_e1000_spi':
e1000_spi.c:472: warning: 'checksum' may be used uninitialized in this function e1000_spi.c:472: note: 'checksum' was declared here
Quoted 5 lines
Signed-off-by Anatolij Gustschin <[email protected]>Cc Kyle Moffett <[email protected]>--- drivers/net/e1000_spi.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
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 Compassion -- that's the one things no machine ever had. Maybe it's the one thing that keeps men ahead of them. -- McCoy, "The Ultimate Computer", stardate 4731.3