Commit 175f02eb authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Kishon Vijay Abraham I

phy: qcom-apq8064: fix possible timeout without check

This patch fixes a possible timeout in poll loop without actually
checking the register before return. In theory the there is a possibility
of loop being scheduled after a long lock/delay, which would then force
the loop to exit without actually checking the register.
Reported-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent f0ed8176
...@@ -91,7 +91,7 @@ static int read_poll_timeout(void __iomem *addr, u32 mask) ...@@ -91,7 +91,7 @@ static int read_poll_timeout(void __iomem *addr, u32 mask)
usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50);
} while (!time_after(jiffies, timeout)); } while (!time_after(jiffies, timeout));
return -ETIMEDOUT; return (readl_relaxed(addr) & mask) ? 0 : -ETIMEDOUT;
} }
static int qcom_apq8064_sata_phy_init(struct phy *generic_phy) static int qcom_apq8064_sata_phy_init(struct phy *generic_phy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment