ARM: OMAP: hwmod: fix an incorrect clk type cast with _get_clkdm

If the main clock for a hwmod is of basic clock type, it is illegal to type
cast this to clk_hw_omap and will result in bogus data. Fixed by checking
the clock flags before attempting the type cast.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
This commit is contained in:
Tero Kristo 2013-07-12 12:26:41 +03:00 committed by Mike Turquette
parent 519ab8b202
commit 924f9498ac

View File

@ -686,6 +686,8 @@ static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
if (oh->clkdm) { if (oh->clkdm) {
return oh->clkdm; return oh->clkdm;
} else if (oh->_clk) { } else if (oh->_clk) {
if (__clk_get_flags(oh->_clk) & CLK_IS_BASIC)
return NULL;
clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
return clk->clkdm; return clk->clkdm;
} }