Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1369643

[PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated

From Nishanth Menon <nm@ti.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated
Date 2016-04-02 01:00 +0200
Message-ID <rjgcO-2HK-17@gated-at.bofh.it> (permalink)
References <rjgcO-2HK-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


omap_rev is used to detect various SoC types, however any misuse of
the usage by invoking it earlier than it being populated will result
in invalid results. Lets flag them as early as possible to prevent
unintended side effects taking place. We get 0 if it is uninitialized
and -1 when detection is done using device tree (as the case was for
DRA7 as the case was prior to commit 06c2d368fc36 ("ARM: OMAP: DRA7:
Make use of omap_revision information for soc_is* calls")

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap1/id.c | 1 +
 arch/arm/mach-omap2/id.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index 52de382fc804..bfabc065d331 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -65,6 +65,7 @@ static struct omap_id omap_ids[] __initdata = {
 
 unsigned int omap_rev(void)
 {
+	WARN_ON_ONCE(!omap_revision || omap_revision == -1);
 	return omap_revision;
 }
 EXPORT_SYMBOL(omap_rev);
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index d85c24918c17..75fb6c006e86 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -46,6 +46,7 @@ u32 omap_features;
 
 unsigned int omap_rev(void)
 {
+	WARN_ON_ONCE(!omap_revision || omap_revision == -1);
 	return omap_revision;
 }
 EXPORT_SYMBOL(omap_rev);
-- 
2.8.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] ARM: OMAP2: Make suspend work again. Nishanth Menon <nm@ti.com> - 2016-04-02 01:00 +0200
  [PATCH 1/3] ARM: OMAP: DRA7: wakeupgen: Skip SAR save for wakeupgen Nishanth Menon <nm@ti.com> - 2016-04-02 01:00 +0200
  [PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated Nishanth Menon <nm@ti.com> - 2016-04-02 01:00 +0200
  Re: [PATCH 0/3] ARM: OMAP2: Make suspend work again. Keerthy <a0393675@ti.com> - 2016-04-04 07:50 +0200
    Re: [PATCH 0/3] ARM: OMAP2: Make suspend work again. Tony Lindgren <tony@atomide.com> - 2016-04-08 18:00 +0200

csiph-web