aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMa Ke <[email protected]>2024-07-02 11:20:42 +0800
committerVinod Koul <[email protected]>2024-07-02 18:42:44 +0530
commit967969cf594ed3c1678a9918d6e9bb2d1591cbe9 (patch)
treec28c4d4cc0586a18471e922825618b840035061c
parentdb4eb418c71a4223b90cac34017ed1f627371da9 (diff)
phy: cadence-torrent: Check return value on register read
cdns_torrent_dp_set_power_state() does not consider that ret might be overwritten. Add return value check of regmap_read_poll_timeout() after register read in cdns_torrent_dp_set_power_state(). Fixes: 5b16a790f18d ("phy: cadence-torrent: Reorder few functions to remove function declarations") Signed-off-by: Ma Ke <[email protected]> Reviewed-by: Roger Quadros <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
-rw-r--r--drivers/phy/cadence/phy-cadence-torrent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index 89e647bff99f..56ce82a47f88 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -1157,6 +1157,9 @@ static int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy,
ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_POWER_STATE_ACK,
read_val, (read_val & mask) == value, 0,
POLL_TIMEOUT_US);
+ if (ret)
+ return ret;
+
cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, 0x00000000);
ndelay(100);