ARM: OMAP4: hsmmc: check for null pointer
authorBalaji T K <balajitk@ti.com>
Wed, 25 Apr 2012 11:57:46 +0000 (17:27 +0530)
committerTony Lindgren <tony@atomide.com>
Wed, 9 May 2012 00:16:24 +0000 (17:16 -0700)
commit1ee47b0ae83e3cae2f9362113b3935898fdb3ea9
tree3ef26910e99261d1f9fbf25b0926fcf708bd3372
parente54bdc187efcc029dd723128fe1fc518f7387d53
ARM: OMAP4: hsmmc: check for null pointer

platform_device pdev can be NULL if CONFIG_MMC_OMAP_HS is not set.
Add check for NULL pointer. while at it move the duplicated functions
to omap4-common.c

Fixes the following boot crash seen with omap4sdp and omap4panda
when MMC is disabled.

Unable to handle kernel NULL pointer dereference at virtual address 0000008c
pgd = c0004000
[0000008c] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 0    Not tainted  (3.4.0-rc1-05971-ga4dfa82 #4)
PC is at omap_4430sdp_init+0x184/0x410
LR is at device_add+0x1a0/0x664

Signed-off-by: Balaji T K <balajitk@ti.com>
Reported-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-4430sdp.c
arch/arm/mach-omap2/board-omap4panda.c
arch/arm/mach-omap2/common.h
arch/arm/mach-omap2/omap4-common.c