diff options
author | Yuval Mintz <Yuval.Mintz@qlogic.com> | 2015-03-29 03:05:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 13:34:10 -0400 |
commit | 0f587f1bfb1fb15d9ebd94c565dd11ae6d4e03b6 (patch) | |
tree | 418790613ce71a53794396ec5cb64caa062ef77a | |
parent | fcd02d27b5c543f2d4538d2ac402fed1154c6dfb (diff) |
bnx2x: Prevent probe as early as possible
It's possible that due to errors [either on PCI or on device itself]
registers reads would fail, returning all-Fs.
This adds a check as early as possible so that driver will not read junk
values and make incorrect probe decisions according to them; instead,
gracefully fail the probe.
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 8120d266e068..768dfb16bc80 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -11650,6 +11650,13 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp) | |||
11650 | u32 val = 0, val2 = 0; | 11650 | u32 val = 0, val2 = 0; |
11651 | int rc = 0; | 11651 | int rc = 0; |
11652 | 11652 | ||
11653 | /* Validate that chip access is feasible */ | ||
11654 | if (REG_RD(bp, MISC_REG_CHIP_NUM) == 0xffffffff) { | ||
11655 | dev_err(&bp->pdev->dev, | ||
11656 | "Chip read returns all Fs. Preventing probe from continuing\n"); | ||
11657 | return -EINVAL; | ||
11658 | } | ||
11659 | |||
11653 | bnx2x_get_common_hwinfo(bp); | 11660 | bnx2x_get_common_hwinfo(bp); |
11654 | 11661 | ||
11655 | /* | 11662 | /* |