diff options
author | Ariel Elior <ariele@broadcom.com> | 2012-01-23 02:31:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-01-23 13:58:18 -0500 |
commit | 65087cfee50595185f6bbf3d78272eeb34186d2b (patch) | |
tree | 544dadaea0da0e94a6a2da32e190f054ff1a5917 | |
parent | 1fdf155158886514c82e5401ab7b1264beb375bf (diff) |
bnx2x: handle CHIP_REVISION during init_one
The macro `CHIP_IS_E1x' requires `bp' to be initialized.
As `bp' is not yet initialized during this phase of `bnx2x_init_dev',
it accessed uninitialized fields in the struct.
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index ffeaaa95ed96..f4c2fe52ab1c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -10536,6 +10536,9 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
10536 | { | 10536 | { |
10537 | struct bnx2x *bp; | 10537 | struct bnx2x *bp; |
10538 | int rc; | 10538 | int rc; |
10539 | bool chip_is_e1x = (board_type == BCM57710 || | ||
10540 | board_type == BCM57711 || | ||
10541 | board_type == BCM57711E); | ||
10539 | 10542 | ||
10540 | SET_NETDEV_DEV(dev, &pdev->dev); | 10543 | SET_NETDEV_DEV(dev, &pdev->dev); |
10541 | bp = netdev_priv(dev); | 10544 | bp = netdev_priv(dev); |
@@ -10624,7 +10627,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
10624 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F0, 0); | 10627 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F0, 0); |
10625 | REG_WR(bp, PXP2_REG_PGL_ADDR_94_F0, 0); | 10628 | REG_WR(bp, PXP2_REG_PGL_ADDR_94_F0, 0); |
10626 | 10629 | ||
10627 | if (CHIP_IS_E1x(bp)) { | 10630 | if (chip_is_e1x) { |
10628 | REG_WR(bp, PXP2_REG_PGL_ADDR_88_F1, 0); | 10631 | REG_WR(bp, PXP2_REG_PGL_ADDR_88_F1, 0); |
10629 | REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F1, 0); | 10632 | REG_WR(bp, PXP2_REG_PGL_ADDR_8C_F1, 0); |
10630 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F1, 0); | 10633 | REG_WR(bp, PXP2_REG_PGL_ADDR_90_F1, 0); |
@@ -10635,9 +10638,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
10635 | * Enable internal target-read (in case we are probed after PF FLR). | 10638 | * Enable internal target-read (in case we are probed after PF FLR). |
10636 | * Must be done prior to any BAR read access. Only for 57712 and up | 10639 | * Must be done prior to any BAR read access. Only for 57712 and up |
10637 | */ | 10640 | */ |
10638 | if (board_type != BCM57710 && | 10641 | if (!chip_is_e1x) |
10639 | board_type != BCM57711 && | ||
10640 | board_type != BCM57711E) | ||
10641 | REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1); | 10642 | REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1); |
10642 | 10643 | ||
10643 | /* Reset the load counter */ | 10644 | /* Reset the load counter */ |