[U-Boot] [PATCH] drivers/net/e1000_spi.c: Fix build warnings
Moffett, Kyle D
Kyle.D.Moffett at boeing.com
Tue Dec 20 17:19:51 CET 2011
On Dec 20, 2011, at 07:29, Anatolij Gustschin 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
Acked-by: Kyle Moffett <Kyle.D.Moffett at boeing.com>
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
> Signed-off-by: Anatolij Gustschin <agust at denx.de>
> Cc: Kyle Moffett <Kyle.D.Moffett at boeing.com>
> ---
> drivers/net/e1000_spi.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c
> index 5491780..5f774f4 100644
> --- a/drivers/net/e1000_spi.c
> +++ b/drivers/net/e1000_spi.c
> @@ -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;
More information about the U-Boot
mailing list