smatch stuff: mtd/cafe_nand: cafe_device_ready() always returns true

Dan Carpenter error27 at gmail.com
Mon Jan 3 14:14:15 EST 2011


Hi David,

cafe_device_ready() always returns 1.  It looks like something else was
intended but I don't know the code enough to say what should go there.

drivers/mtd/nand/cafe_nand.c +107 cafe_device_ready(3)
	warn: condition is always true

   104  static int cafe_device_ready(struct mtd_info *mtd)
   105  {
   106          struct cafe_priv *cafe = mtd->priv;
   107          int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000);
                                                             ^^^^^^^^^^^^^
	This bit is always non-zero because we take the result of
	cafe_readl() and do a bitwize or with 0x40000000.  Then the
	double negate means that result is always 1.

   108          uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
   109

regards,
dan carpenter




More information about the linux-mtd mailing list