diff options
author | Vipul Pandya <vipul@chelsio.com> | 2012-11-05 22:37:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-07 15:43:26 -0500 |
commit | 0062b15c107d756dd7c9e41d023e87f876320c97 (patch) | |
tree | e1bc0afb21d6d7886cba2faaf2d2372e38e70d4e | |
parent | a3d744e995d2b936c500585ae39d99ee251c89b4 (diff) |
cxgb4: Initialize data structures before using.
We should not assume reserve fields to be don't cares as fields may change.
Clearing data structures before using.
Signed-off-by: Jay Hernandez <jay@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 32eec15fe4c2..01fa5b79162c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -2519,6 +2519,7 @@ int t4_fw_bye(struct adapter *adap, unsigned int mbox) | |||
2519 | { | 2519 | { |
2520 | struct fw_bye_cmd c; | 2520 | struct fw_bye_cmd c; |
2521 | 2521 | ||
2522 | memset(&c, 0, sizeof(c)); | ||
2522 | INIT_CMD(c, BYE, WRITE); | 2523 | INIT_CMD(c, BYE, WRITE); |
2523 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); | 2524 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); |
2524 | } | 2525 | } |
@@ -2535,6 +2536,7 @@ int t4_early_init(struct adapter *adap, unsigned int mbox) | |||
2535 | { | 2536 | { |
2536 | struct fw_initialize_cmd c; | 2537 | struct fw_initialize_cmd c; |
2537 | 2538 | ||
2539 | memset(&c, 0, sizeof(c)); | ||
2538 | INIT_CMD(c, INITIALIZE, WRITE); | 2540 | INIT_CMD(c, INITIALIZE, WRITE); |
2539 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); | 2541 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); |
2540 | } | 2542 | } |
@@ -2551,6 +2553,7 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset) | |||
2551 | { | 2553 | { |
2552 | struct fw_reset_cmd c; | 2554 | struct fw_reset_cmd c; |
2553 | 2555 | ||
2556 | memset(&c, 0, sizeof(c)); | ||
2554 | INIT_CMD(c, RESET, WRITE); | 2557 | INIT_CMD(c, RESET, WRITE); |
2555 | c.val = htonl(reset); | 2558 | c.val = htonl(reset); |
2556 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); | 2559 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); |
@@ -3278,6 +3281,7 @@ int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, | |||
3278 | { | 3281 | { |
3279 | struct fw_vi_enable_cmd c; | 3282 | struct fw_vi_enable_cmd c; |
3280 | 3283 | ||
3284 | memset(&c, 0, sizeof(c)); | ||
3281 | c.op_to_viid = htonl(FW_CMD_OP(FW_VI_ENABLE_CMD) | FW_CMD_REQUEST | | 3285 | c.op_to_viid = htonl(FW_CMD_OP(FW_VI_ENABLE_CMD) | FW_CMD_REQUEST | |
3282 | FW_CMD_EXEC | FW_VI_ENABLE_CMD_VIID(viid)); | 3286 | FW_CMD_EXEC | FW_VI_ENABLE_CMD_VIID(viid)); |
3283 | c.ien_to_len16 = htonl(FW_VI_ENABLE_CMD_LED | FW_LEN16(c)); | 3287 | c.ien_to_len16 = htonl(FW_VI_ENABLE_CMD_LED | FW_LEN16(c)); |