Commit 545fea54 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

netxen: fix error handling in netxen_get_flash_block()

My static checker complained that "v" can be used unintialized if
netxen_rom_fast_read() returns -EIO.  That function never actually
returns -1.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 28892865
...@@ -1015,20 +1015,24 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base, ...@@ -1015,20 +1015,24 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
{ {
int i, v, addr; int i, v, addr;
__le32 *ptr32; __le32 *ptr32;
int ret;
addr = base; addr = base;
ptr32 = buf; ptr32 = buf;
for (i = 0; i < size / sizeof(u32); i++) { for (i = 0; i < size / sizeof(u32); i++) {
if (netxen_rom_fast_read(adapter, addr, &v) == -1) ret = netxen_rom_fast_read(adapter, addr, &v);
return -1; if (ret)
return ret;
*ptr32 = cpu_to_le32(v); *ptr32 = cpu_to_le32(v);
ptr32++; ptr32++;
addr += sizeof(u32); addr += sizeof(u32);
} }
if ((char *)buf + size > (char *)ptr32) { if ((char *)buf + size > (char *)ptr32) {
__le32 local; __le32 local;
if (netxen_rom_fast_read(adapter, addr, &v) == -1) ret = netxen_rom_fast_read(adapter, addr, &v);
return -1; if (ret)
return ret;
local = cpu_to_le32(v); local = cpu_to_le32(v);
memcpy(ptr32, &local, (char *)buf + size - (char *)ptr32); memcpy(ptr32, &local, (char *)buf + size - (char *)ptr32);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment