Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Srinivas Kandagatla and committed by
Kishon Vijay Abraham I
175f02eb f0ed8176

+1 -1
+1 -1
drivers/phy/phy-qcom-apq8064-sata.c
··· 91 91 usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); 92 92 } while (!time_after(jiffies, timeout)); 93 93 94 - return -ETIMEDOUT; 94 + return (readl_relaxed(addr) & mask) ? 0 : -ETIMEDOUT; 95 95 } 96 96 97 97 static int qcom_apq8064_sata_phy_init(struct phy *generic_phy)