Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nicolae Rosia and committed by
Tony Lindgren
0ab11d8e 4ae46efc

+6
+6
arch/arm/mach-omap2/voltage.c
··· 87 87 return -ENODATA; 88 88 } 89 89 90 + if (!voltdm->volt_data) { 91 + pr_err("%s: No voltage data defined for vdd_%s\n", 92 + __func__, voltdm->name); 93 + return -ENODATA; 94 + } 95 + 90 96 /* Adjust voltage to the exact voltage from the OPP table */ 91 97 for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) { 92 98 if (voltdm->volt_data[i].volt_nominal >= target_volt) {