diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-06-16 15:05:58 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2019-06-20 15:39:43 -0400 |
commit | da3929218a4481fc12f9eaa30c9edb09aad5ff24 (patch) | |
tree | d530f5d7251dfd6776ad6755fdabff0567e4fc27 /drivers/infiniband/hw/hns/hns_roce_hw_v1.c | |
parent | RDMA: Check umem pointer validity prior to release (diff) | |
download | linux-dev-da3929218a4481fc12f9eaa30c9edb09aad5ff24.tar.xz linux-dev-da3929218a4481fc12f9eaa30c9edb09aad5ff24.zip |
RDMa/hns: Don't stuck in endless timeout loop
The "end" variable is declared as unsigned and can't be negative, it
leads to the situation where timeout limit is not honored, so let's
convert logic to ensure that loop is bounded.
drivers/infiniband/hw/hns/hns_roce_hw_v1.c: In function _hns_roce_v1_clear_hem_:
drivers/infiniband/hw/hns/hns_roce_hw_v1.c:2471:12: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
2471 | if (end < 0) {
| ^
Fixes: 669cefb654cb ("RDMA/hns: Remove jiffies operation in disable interrupt context")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c index cb004190ccba..2c0bc2536fda 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c @@ -2467,7 +2467,7 @@ static int hns_roce_v1_clear_hem(struct hns_roce_dev *hr_dev, end = HW_SYNC_TIMEOUT_MSECS; while (1) { if (readl(bt_cmd) >> BT_CMD_SYNC_SHIFT) { - if (end < 0) { + if (!end) { dev_err(dev, "Write bt_cmd err,hw_sync is not zero.\n"); spin_unlock_irqrestore(&hr_dev->bt_cmd_lock, flags); |