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

Dan Carpenter error27 at gmail.com
Sat Jun 9 05:37:22 EDT 2012


On 1/3/11, Dan Carpenter <error27 at gmail.com> wrote:
> 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.
>

Probably we should just change the | to an &.  I'll send a patch for that.

regards,
dan carpenter

> 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