From: Tero Kristo Date: Fri, 12 Jul 2013 09:26:41 +0000 (+0300) Subject: ARM: OMAP: hwmod: fix an incorrect clk type cast with _get_clkdm X-Git-Tag: Ubuntu-5.13.0-19.19~20723^2~15 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=924f9498acb004d8cb704a008f1060fad604ccca;p=mirror_ubuntu-jammy-kernel.git 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 Tested-by: Nishanth Menon Acked-by: Tony Lindgren Signed-off-by: Mike Turquette --- diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 8a1b5e0bad40..cc24c95b77e5 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -686,6 +686,8 @@ static struct clockdomain *_get_clkdm(struct omap_hwmod *oh) if (oh->clkdm) { return oh->clkdm; } 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)); return clk->clkdm; }