diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-05-15 13:16:45 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2009-05-15 13:16:45 -0400 |
commit | 28e43a519b9edb8277fc6b490ad17aa38c45a02b (patch) | |
tree | 56fd31d1d4e67a770d4fe55bff0ae570e4a7df3f /drivers/infiniband/hw | |
parent | 210af919c949a7d6bd330916ef376cec2907d81e (diff) |
RDMA/nes: Fix off-by-one bugs in reset_adapter_ne020() and init_serdes()
With a postfix increment, i is incremented one past 10K/5K before the
loop ends, so the error messages will be displayed too soon if the
test succeeds on the last iteration. Fix the comparisons to be >
instead of >=.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index b832a7b814a2..4a84d02ece06 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -667,7 +667,7 @@ static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_ | |||
667 | i = 0; | 667 | i = 0; |
668 | while (((nes_read32(nesdev->regs+NES_SOFTWARE_RESET) & 0x00000040) == 0) && i++ < 10000) | 668 | while (((nes_read32(nesdev->regs+NES_SOFTWARE_RESET) & 0x00000040) == 0) && i++ < 10000) |
669 | mdelay(1); | 669 | mdelay(1); |
670 | if (i >= 10000) { | 670 | if (i > 10000) { |
671 | nes_debug(NES_DBG_INIT, "Did not see full soft reset done.\n"); | 671 | nes_debug(NES_DBG_INIT, "Did not see full soft reset done.\n"); |
672 | return 0; | 672 | return 0; |
673 | } | 673 | } |
@@ -675,7 +675,7 @@ static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_ | |||
675 | i = 0; | 675 | i = 0; |
676 | while ((nes_read_indexed(nesdev, NES_IDX_INT_CPU_STATUS) != 0x80) && i++ < 10000) | 676 | while ((nes_read_indexed(nesdev, NES_IDX_INT_CPU_STATUS) != 0x80) && i++ < 10000) |
677 | mdelay(1); | 677 | mdelay(1); |
678 | if (i >= 10000) { | 678 | if (i > 10000) { |
679 | printk(KERN_ERR PFX "Internal CPU not ready, status = %02X\n", | 679 | printk(KERN_ERR PFX "Internal CPU not ready, status = %02X\n", |
680 | nes_read_indexed(nesdev, NES_IDX_INT_CPU_STATUS)); | 680 | nes_read_indexed(nesdev, NES_IDX_INT_CPU_STATUS)); |
681 | return 0; | 681 | return 0; |
@@ -701,7 +701,7 @@ static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_ | |||
701 | i = 0; | 701 | i = 0; |
702 | while (((nes_read32(nesdev->regs+NES_SOFTWARE_RESET) & 0x00000040) == 0) && i++ < 10000) | 702 | while (((nes_read32(nesdev->regs+NES_SOFTWARE_RESET) & 0x00000040) == 0) && i++ < 10000) |
703 | mdelay(1); | 703 | mdelay(1); |
704 | if (i >= 10000) { | 704 | if (i > 10000) { |
705 | nes_debug(NES_DBG_INIT, "Did not see port soft reset done.\n"); | 705 | nes_debug(NES_DBG_INIT, "Did not see port soft reset done.\n"); |
706 | return 0; | 706 | return 0; |
707 | } | 707 | } |
@@ -711,7 +711,7 @@ static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_ | |||
711 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS0) | 711 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS0) |
712 | & 0x0000000f)) != 0x0000000f) && i++ < 5000) | 712 | & 0x0000000f)) != 0x0000000f) && i++ < 5000) |
713 | mdelay(1); | 713 | mdelay(1); |
714 | if (i >= 5000) { | 714 | if (i > 5000) { |
715 | nes_debug(NES_DBG_INIT, "Serdes 0 not ready, status=%x\n", u32temp); | 715 | nes_debug(NES_DBG_INIT, "Serdes 0 not ready, status=%x\n", u32temp); |
716 | return 0; | 716 | return 0; |
717 | } | 717 | } |
@@ -722,7 +722,7 @@ static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_ | |||
722 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS1) | 722 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS1) |
723 | & 0x0000000f)) != 0x0000000f) && i++ < 5000) | 723 | & 0x0000000f)) != 0x0000000f) && i++ < 5000) |
724 | mdelay(1); | 724 | mdelay(1); |
725 | if (i >= 5000) { | 725 | if (i > 5000) { |
726 | nes_debug(NES_DBG_INIT, "Serdes 1 not ready, status=%x\n", u32temp); | 726 | nes_debug(NES_DBG_INIT, "Serdes 1 not ready, status=%x\n", u32temp); |
727 | return 0; | 727 | return 0; |
728 | } | 728 | } |
@@ -792,7 +792,7 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, | |||
792 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS0) | 792 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS0) |
793 | & 0x0000000f)) != 0x0000000f) && i++ < 5000) | 793 | & 0x0000000f)) != 0x0000000f) && i++ < 5000) |
794 | mdelay(1); | 794 | mdelay(1); |
795 | if (i >= 5000) { | 795 | if (i > 5000) { |
796 | nes_debug(NES_DBG_PHY, "Init: serdes 0 not ready, status=%x\n", u32temp); | 796 | nes_debug(NES_DBG_PHY, "Init: serdes 0 not ready, status=%x\n", u32temp); |
797 | return 1; | 797 | return 1; |
798 | } | 798 | } |
@@ -815,7 +815,7 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, | |||
815 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS1) | 815 | while (((u32temp = (nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_STATUS1) |
816 | & 0x0000000f)) != 0x0000000f) && (i++ < 5000)) | 816 | & 0x0000000f)) != 0x0000000f) && (i++ < 5000)) |
817 | mdelay(1); | 817 | mdelay(1); |
818 | if (i >= 5000) { | 818 | if (i > 5000) { |
819 | printk("%s: Init: serdes 1 not ready, status=%x\n", __func__, u32temp); | 819 | printk("%s: Init: serdes 1 not ready, status=%x\n", __func__, u32temp); |
820 | /* return 1; */ | 820 | /* return 1; */ |
821 | } | 821 | } |