Commit a76fc9dd authored by Suman Anna's avatar Suman Anna Committed by Tony Lindgren

ARM: OMAP: dmtimer: check for pm_runtime_get_sync() failure

The current OMAP dmtimer probe does not check for the return
status of pm_runtime_get_sync() before initializing the timer
registers. Any timer with missing hwmod data would return a
failure here, and the access of registers without enabling the
clocks for the timer would trigger a l3_noc interrupt and a
kernel boot hang. Add proper checking so that the probe would
return a failure graciously without hanging the kernel boot.
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent e5ed5b60
...@@ -799,6 +799,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev) ...@@ -799,6 +799,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct of_device_id *match; const struct of_device_id *match;
const struct dmtimer_platform_data *pdata; const struct dmtimer_platform_data *pdata;
int ret;
match = of_match_device(of_match_ptr(omap_timer_match), dev); match = of_match_device(of_match_ptr(omap_timer_match), dev);
pdata = match ? match->data : dev->platform_data; pdata = match ? match->data : dev->platform_data;
...@@ -860,7 +861,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev) ...@@ -860,7 +861,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
} }
if (!timer->reserved) { if (!timer->reserved) {
pm_runtime_get_sync(dev); ret = pm_runtime_get_sync(dev);
if (ret < 0) {
dev_err(dev, "%s: pm_runtime_get_sync failed!\n",
__func__);
goto err_get_sync;
}
__omap_dm_timer_init_regs(timer); __omap_dm_timer_init_regs(timer);
pm_runtime_put(dev); pm_runtime_put(dev);
} }
...@@ -873,6 +879,11 @@ static int omap_dm_timer_probe(struct platform_device *pdev) ...@@ -873,6 +879,11 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
dev_dbg(dev, "Device Probed.\n"); dev_dbg(dev, "Device Probed.\n");
return 0; return 0;
err_get_sync:
pm_runtime_put_noidle(dev);
pm_runtime_disable(dev);
return ret;
} }
/** /**
......
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