linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nuc900_nand: read correct SMISR register
@ 2016-01-13 21:38 Arnd Bergmann
  2016-01-13 21:50 ` Brian Norris
  2016-01-15 18:03 ` Brian Norris
  0 siblings, 2 replies; 10+ messages in thread
From: Arnd Bergmann @ 2016-01-13 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

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);
 

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

end of thread, other threads:[~2016-01-15 18:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 22:02   ` Arnd Bergmann
2016-01-14  0:29     ` Brian Norris
2016-01-14  9:34       ` Wan Zongshun
2016-01-14 12:08         ` Arnd Bergmann
2016-01-15  7:53           ` Wan Zongshun
2016-01-15 11:03             ` Arnd Bergmann
2016-01-15 15:01               ` Wan Zongshun
2016-01-15 18:03 ` Brian Norris

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).