All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: zengzhaoxiu@163.com
Cc: kgene@kernel.org, k.kozlowski@samsung.com, richard@nod.at,
	dwmw2@infradead.org, computersforpeace@gmail.com,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
Subject: Re: [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()
Date: Tue, 12 Apr 2016 13:34:24 +0200	[thread overview]
Message-ID: <20160412133424.6ac1193e@bbrezillon> (raw)
In-Reply-To: <1460446235-987-1-git-send-email-zengzhaoxiu@163.com>

On Tue, 12 Apr 2016 15:30:35 +0800
zengzhaoxiu@163.com wrote:

> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
> 
> If there is only one bit difference in the ECC, the function should return 1.
> The result of "diff0 & ~(1<<fls(diff0))" is equal to diff0, so the function
> actually returns -1.
> 
> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Applied.

Thanks,

Boris

> ---
>  drivers/mtd/nand/s3c2410.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index 9c9397b..86ffb73 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -542,7 +542,8 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
>  	diff0 |= (diff1 << 8);
>  	diff0 |= (diff2 << 16);
>  
> -	if ((diff0 & ~(1<<fls(diff0))) == 0)
> +	/* equal to "(diff0 & ~(1 << __ffs(diff0)))" */
> +	if ((diff0 & (diff0 - 1)) == 0)
>  		return 1;
>  
>  	return -1;



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()
Date: Tue, 12 Apr 2016 13:34:24 +0200	[thread overview]
Message-ID: <20160412133424.6ac1193e@bbrezillon> (raw)
In-Reply-To: <1460446235-987-1-git-send-email-zengzhaoxiu@163.com>

On Tue, 12 Apr 2016 15:30:35 +0800
zengzhaoxiu at 163.com wrote:

> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
> 
> If there is only one bit difference in the ECC, the function should return 1.
> The result of "diff0 & ~(1<<fls(diff0))" is equal to diff0, so the function
> actually returns -1.
> 
> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Applied.

Thanks,

Boris

> ---
>  drivers/mtd/nand/s3c2410.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index 9c9397b..86ffb73 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -542,7 +542,8 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
>  	diff0 |= (diff1 << 8);
>  	diff0 |= (diff2 << 16);
>  
> -	if ((diff0 & ~(1<<fls(diff0))) == 0)
> +	/* equal to "(diff0 & ~(1 << __ffs(diff0)))" */
> +	if ((diff0 & (diff0 - 1)) == 0)
>  		return 1;
>  
>  	return -1;



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-04-12 11:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 16:48 [PATCH] mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data() zengzhaoxiu
2016-04-07 16:48 ` zengzhaoxiu at 163.com
2016-04-08  0:18 ` Boris Brezillon
2016-04-08  0:18   ` Boris Brezillon
2016-04-08  1:51   ` Zeng Zhaoxiu
2016-04-08  1:51     ` Zeng Zhaoxiu
2016-04-08  2:18     ` Boris Brezillon
2016-04-08  2:18       ` Boris Brezillon
2016-04-08  5:37       ` Zeng Zhaoxiu
2016-04-08  5:37         ` Zeng Zhaoxiu
2016-04-11  7:49         ` Boris Brezillon
2016-04-11  7:49           ` Boris Brezillon
2016-04-12  7:30           ` zengzhaoxiu
2016-04-12  7:30             ` zengzhaoxiu at 163.com
2016-04-12 11:34             ` Boris Brezillon [this message]
2016-04-12 11:34               ` Boris Brezillon

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=20160412133424.6ac1193e@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=zengzhaoxiu@163.com \
    --cc=zhaoxiu.zeng@gmail.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.