ARM: OMAP2+: hwmod: check for module address space during init
authorSuman Anna <s-anna@ti.com>
Wed, 9 Oct 2013 05:46:49 +0000 (23:46 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Nov 2013 19:27:55 +0000 (11:27 -0800)
commit19dbd3f28ce670a6b016c595e29626d1533bba39
tree85de7c1151b331ede2e8f43a00e85460113c6562
parentce0b80a71ba1a749abaffa5e5883582d54ffe66e
ARM: OMAP2+: hwmod: check for module address space during init

commit 6423d6df1440a8acfc2f375d7cbc4cd66c2e6910 upstream.

The hwmod init sequence involves initializing and idling all the
hwmods during bootup. If a module class has sysconfig, the init
sequence utilizes the module register base for performing any
sysc configuration.

The module address space is being removed from hwmod database and
retrieved from the <reg> property of the corresponding DT node.
If a hwmod does not have its corresponding DT node defined and the
memory address space is not defined in the corresponding
omap_hwmod_ocp_if, then the module register target address space
would be NULL and any sysc programming would result in a NULL
pointer dereference and a kernel boot hang.

Handle this scenario by checking for a valid module address space
during the _init of each hwmod, and leaving it in the registered
state if no module register address base is defined in either of
the hwmod data or the DT data.

Signed-off-by: Suman Anna <s-anna@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
[paul@pwsan.com: use -ENXIO rather than -ENOMEM to indicate a missing address
 space error; fixed checkpatch.pl problem]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mach-omap2/omap_hwmod.c