From: Arnd Bergmann <arnd@arndb.de>
To: Brian Norris <computersforpeace@gmail.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-arm-kernel@lists.infradead.org,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mtd: nuc900_nand: read correct SMISR register
Date: Wed, 13 Jan 2016 22:38:08 +0100 [thread overview]
Message-ID: <9019174.GYajdpGP8V@wuerfel> (raw)
The nuc900_nand driver has always passed an incorrect register
address in its nuc900_check_rb() function, which cannot possibly
work, and in some configurations gives us a build warning:
drivers/mtd/nand/nuc900_nand.c: In function 'nuc900_check_rb':
drivers/mtd/nand/nuc900_nand.c:27:23: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast [-Wint-conversion]
#define REG_SMISR 0xac
drivers/mtd/nand/nuc900_nand.c:118:20: note: in expansion of macro 'REG_SMISR'
val = __raw_readl(REG_SMISR);
This makes sure we actually read from the register rather than
from (void *)0x000000ac in user space.
I suspect nobody noticed this before because the nuc900_nand_devready()
function never gets called, or nobody uses this driver on an upstream
kernel. Possibly even both.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/drivers/mtd/nand/nuc900_nand.c b/drivers/mtd/nand/nuc900_nand.c
index 220ddfcf29f5..dbc5b571c2bb 100644
--- a/drivers/mtd/nand/nuc900_nand.c
+++ b/drivers/mtd/nand/nuc900_nand.c
@@ -113,7 +113,7 @@ static int nuc900_check_rb(struct nuc900_nand *nand)
{
unsigned int val;
spin_lock(&nand->lock);
- val = __raw_readl(REG_SMISR);
+ val = __raw_readl(nand->reg + REG_SMISR);
val &= READYBUSY;
spin_unlock(&nand->lock);
WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mtd: nuc900_nand: read correct SMISR register
Date: Wed, 13 Jan 2016 22:38:08 +0100 [thread overview]
Message-ID: <9019174.GYajdpGP8V@wuerfel> (raw)
The nuc900_nand driver has always passed an incorrect register
address in its nuc900_check_rb() function, which cannot possibly
work, and in some configurations gives us a build warning:
drivers/mtd/nand/nuc900_nand.c: In function 'nuc900_check_rb':
drivers/mtd/nand/nuc900_nand.c:27:23: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast [-Wint-conversion]
#define REG_SMISR 0xac
drivers/mtd/nand/nuc900_nand.c:118:20: note: in expansion of macro 'REG_SMISR'
val = __raw_readl(REG_SMISR);
This makes sure we actually read from the register rather than
from (void *)0x000000ac in user space.
I suspect nobody noticed this before because the nuc900_nand_devready()
function never gets called, or nobody uses this driver on an upstream
kernel. Possibly even both.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/drivers/mtd/nand/nuc900_nand.c b/drivers/mtd/nand/nuc900_nand.c
index 220ddfcf29f5..dbc5b571c2bb 100644
--- a/drivers/mtd/nand/nuc900_nand.c
+++ b/drivers/mtd/nand/nuc900_nand.c
@@ -113,7 +113,7 @@ static int nuc900_check_rb(struct nuc900_nand *nand)
{
unsigned int val;
spin_lock(&nand->lock);
- val = __raw_readl(REG_SMISR);
+ val = __raw_readl(nand->reg + REG_SMISR);
val &= READYBUSY;
spin_unlock(&nand->lock);
next reply other threads:[~2016-01-13 21:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 21:38 Arnd Bergmann [this message]
2016-01-13 21:38 ` [PATCH] mtd: nuc900_nand: read correct SMISR register Arnd Bergmann
2016-01-13 21:50 ` Brian Norris
2016-01-13 21:50 ` Brian Norris
2016-01-13 22:02 ` Arnd Bergmann
2016-01-13 22:02 ` Arnd Bergmann
2016-01-14 0:29 ` Brian Norris
2016-01-14 0:29 ` Brian Norris
2016-01-14 9:34 ` Wan Zongshun
2016-01-14 9:34 ` Wan Zongshun
2016-01-14 12:08 ` Arnd Bergmann
2016-01-14 12:08 ` Arnd Bergmann
2016-01-15 7:53 ` Wan Zongshun
2016-01-15 7:53 ` Wan Zongshun
2016-01-15 11:03 ` Arnd Bergmann
2016-01-15 11:03 ` Arnd Bergmann
2016-01-15 15:01 ` Wan Zongshun
2016-01-15 15:01 ` Wan Zongshun
2016-01-15 18:03 ` Brian Norris
2016-01-15 18:03 ` Brian Norris
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=9019174.GYajdpGP8V@wuerfel \
--to=arnd@arndb.de \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mcuos.com@gmail.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.