mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
clocksource/drivers/timer-ti-dm: Handle runtime resume failure
omap_dm_timer_write_counter() accesses timer registers and updates the
saved counter value after requesting a runtime PM reference. If runtime
resume fails, the timer remains inaccessible and no reference is
acquired, but the function still writes the register, drops a
reference, updates the cached value, and reports success.
Check the return value and propagate an error before touching the timer
state.
Fixes: 0494fc345b ("clocksource/drivers/timer-ti-dm : Capture functionality for OMAP DM timer")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Link: https://patch.msgid.link/20261003080812.429386-1-yaojiale02@163.com
This commit is contained in:
parent
e234d40823
commit
c40b76c8cf
|
|
@ -1095,6 +1095,7 @@ static int omap_dm_timer_write_counter(struct omap_dm_timer *cookie, unsigned in
|
|||
{
|
||||
struct dmtimer *timer;
|
||||
struct device *dev;
|
||||
int ret;
|
||||
|
||||
timer = to_dmtimer(cookie);
|
||||
if (unlikely(!timer)) {
|
||||
|
|
@ -1104,7 +1105,10 @@ static int omap_dm_timer_write_counter(struct omap_dm_timer *cookie, unsigned in
|
|||
|
||||
dev = &timer->pdev->dev;
|
||||
|
||||
pm_runtime_resume_and_get(dev);
|
||||
ret = pm_runtime_resume_and_get(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dmtimer_write(timer, OMAP_TIMER_COUNTER_REG, value);
|
||||
pm_runtime_put_sync(dev);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user