linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP2+: avoid NULL pointer dereference
@ 2016-11-01  9:49 Nicolae Rosia
  2016-11-07 23:25 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolae Rosia @ 2016-11-01  9:49 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Nicolae Rosia, linux-arm-kernel

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>
---
 arch/arm/mach-omap2/voltage.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index cba8cad..cd15dbd 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) {
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: OMAP2+: avoid NULL pointer dereference
  2016-11-01  9:49 [PATCH] ARM: OMAP2+: avoid NULL pointer dereference Nicolae Rosia
@ 2016-11-07 23:25 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2016-11-07 23:25 UTC (permalink / raw)
  To: Nicolae Rosia; +Cc: linux-omap, linux-arm-kernel

* Nicolae Rosia <Nicolae_Rosia@mentor.com> [161101 02:50]:
> 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.

Thanks applying into omap-for-v4.9/fixes.

Tony

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-07 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01  9:49 [PATCH] ARM: OMAP2+: avoid NULL pointer dereference Nicolae Rosia
2016-11-07 23:25 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).