All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Mike Dunn <mikedunn@newsguy.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>
Subject: [patch] mtd: cafe_nand: fix an & vs | mistake
Date: Sat, 09 Jun 2012 16:08:25 +0000	[thread overview]
Message-ID: <20120609160825.GC6488@elgon.mountain> (raw)
In-Reply-To: <20110103191415.GA15176@bicker>

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 <dan.carpenter@oracle.com>
---
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);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Mike Dunn <mikedunn@newsguy.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>
Subject: [patch] mtd: cafe_nand: fix an & vs | mistake
Date: Sat, 9 Jun 2012 19:08:25 +0300	[thread overview]
Message-ID: <20120609160825.GC6488@elgon.mountain> (raw)
In-Reply-To: <20110103191415.GA15176@bicker>

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 <dan.carpenter@oracle.com>
---
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);

  parent reply	other threads:[~2012-06-09 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-03 19:14 smatch stuff: mtd/cafe_nand: cafe_device_ready() always returns true Dan Carpenter
2012-06-09  9:37 ` Dan Carpenter
2012-06-09 16:08 ` Dan Carpenter [this message]
2012-06-09 16:08   ` [patch] mtd: cafe_nand: fix an & vs | mistake Dan Carpenter
2012-06-18 11:07   ` Artem Bityutskiy
2012-06-18 11:07     ` Artem Bityutskiy
2012-06-18 11:25   ` Artem Bityutskiy
2012-06-18 11:25     ` Artem Bityutskiy
2012-08-17 21:44     ` Daniel Drake
2012-08-17 21:44       ` Daniel Drake

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=20120609160825.GC6488@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mikedunn@newsguy.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.