From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from rcsinet15.oracle.com ([148.87.113.117]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SdODU-0000qV-Qb for linux-mtd@lists.infradead.org; Sat, 09 Jun 2012 16:08:45 +0000 Date: Sat, 9 Jun 2012 19:08:25 +0300 From: Dan Carpenter To: David Woodhouse Subject: [patch] mtd: cafe_nand: fix an & vs | mistake Message-ID: <20120609160825.GC6488@elgon.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110103191415.GA15176@bicker> Cc: Mike Dunn , Dmitry Eremin-Solenikov , Artem Bityutskiy , kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, Brian Norris List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , The intent here was clearly to set result to true if the 0x40000000 flag was set. But instead there was a | vs & typo and we always set result to true. Signed-off-by: Dan Carpenter --- I do not have the hardware to test this. The original code is clearly buggy, but what about if 0x40000000 is the wrong flag? diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index f3594a6..ac0d967 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c @@ -102,7 +102,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; static int cafe_device_ready(struct mtd_info *mtd) { struct cafe_priv *cafe = mtd->priv; - int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000); + int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000); uint32_t irqs = cafe_readl(cafe, NAND_IRQ); cafe_writel(cafe, irqs, NAND_IRQ);