summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorNicolae Rosia <Nicolae_Rosia@mentor.com>2016-11-01 10:49:25 +0100
committerTony Lindgren <tony@atomide.com>2016-11-08 00:24:53 +0100
commit0ab11d8ea46fd6faf67df4461c795091429a1496 (patch)
treeb98ea15a3fae04137c74c55bb1308eb87ef0e9ad /arch
parentARM: OMAP2+: PRM: initialize en_uart4_mask and grpsel_uart4_mask (diff)
downloadlinux-0ab11d8ea46fd6faf67df4461c795091429a1496.tar.xz
linux-0ab11d8ea46fd6faf67df4461c795091429a1496.zip
ARM: OMAP2+: avoid NULL pointer dereference
For OMAP4, volt_data is set in omap44xx_voltagedomains_init. If the SoC is neither OMAP443X or OMAP446X, we end up with a NULL in volt_data which causes a kernel oops. This is the case when booting OMAP4470. Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/voltage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index cba8cada8c81..cd15dbd62671 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -87,6 +87,12 @@ int voltdm_scale(struct voltagedomain *voltdm,
return -ENODATA;
}
+ if (!voltdm->volt_data) {
+ pr_err("%s: No voltage data defined for vdd_%s\n",
+ __func__, voltdm->name);
+ return -ENODATA;
+ }
+
/* Adjust voltage to the exact voltage from the OPP table */
for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
if (voltdm->volt_data[i].volt_nominal >= target_volt) {