[patch] mtd: cafe_nand: fix an & vs | mistake

Artem Bityutskiy artem.bityutskiy at linux.intel.com
Mon Jun 18 07:25:02 EDT 2012


Pushed this patch to l2-mtd.git and added CC to -stable. The patch seems
to be a real bug-fix. Daniel, could you please check it - it will be
shame if it hits -stable and breaks something.

Thanks!

On Sat, 2012-06-09 at 19:08 +0300, Dan Carpenter wrote:
> 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 at 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);
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120618/6012870f/attachment.sig>


More information about the linux-mtd mailing list