]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: OMAP2+: avoid NULL pointer dereference
authorNicolae Rosia <Nicolae_Rosia@mentor.com>
Tue, 1 Nov 2016 09:49:25 +0000 (11:49 +0200)
committerTony Lindgren <tony@atomide.com>
Mon, 7 Nov 2016 23:24:53 +0000 (16:24 -0700)
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>
arch/arm/mach-omap2/voltage.c

index cba8cada8c81a07a9cd5ee7ebc12108aa41597a5..cd15dbd62671690388b841199d2c18f52811504f 100644 (file)
@@ -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) {