All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-omap@vger.kernel.org>, Nishanth Menon <nm@ti.com>
Subject: [PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated
Date: Fri, 1 Apr 2016 17:53:07 -0500	[thread overview]
Message-ID: <1459551187-5992-4-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1459551187-5992-1-git-send-email-nm@ti.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Menon <nm@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Nishanth Menon <nm@ti.com>,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated
Date: Fri, 1 Apr 2016 17:53:07 -0500	[thread overview]
Message-ID: <1459551187-5992-4-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1459551187-5992-1-git-send-email-nm@ti.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: nm@ti.com (Nishanth Menon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated
Date: Fri, 1 Apr 2016 17:53:07 -0500	[thread overview]
Message-ID: <1459551187-5992-4-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1459551187-5992-1-git-send-email-nm@ti.com>

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

  parent reply	other threads:[~2016-04-01 22:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 22:53 [PATCH 0/3] ARM: OMAP2: Make suspend work again Nishanth Menon
2016-04-01 22:53 ` Nishanth Menon
2016-04-01 22:53 ` Nishanth Menon
2016-04-01 22:53 ` [PATCH 1/3] ARM: OMAP: DRA7: wakeupgen: Skip SAR save for wakeupgen Nishanth Menon
2016-04-01 22:53   ` Nishanth Menon
2016-04-01 22:53   ` Nishanth Menon
2016-04-01 22:53 ` [PATCH 2/3] ARM: OMAP: DRA7: Provide proper class to omap2_set_globals_tap Nishanth Menon
2016-04-01 22:53   ` Nishanth Menon
2016-04-01 22:53   ` Nishanth Menon
2016-04-01 22:53 ` Nishanth Menon [this message]
2016-04-01 22:53   ` [PATCH 3/3] ARM: OMAP: Catch callers of revision information prior to it being populated Nishanth Menon
2016-04-01 22:53   ` Nishanth Menon
2016-04-04  5:47 ` [PATCH 0/3] ARM: OMAP2: Make suspend work again Keerthy
2016-04-04  5:47   ` Keerthy
2016-04-04  5:47   ` Keerthy
2016-04-08 15:56   ` Tony Lindgren
2016-04-08 15:56     ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459551187-5992-4-git-send-email-nm@ti.com \
    --to=nm@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.