diff mbox

mtd: subpagetest: fix wrong written check in function write_eraseblock2

Message ID 1496307679-16245-1-git-send-email-xiaolei.li@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

xiaolei li June 1, 2017, 9:01 a.m. UTC
From: Xiaolei Li <xiaolei.li@mediatek.com>

Write size in function write_eraseblock2 is subpgsize * k.
It is wrong to check whether written is equal to subpgsize after each
mtd_write.

Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
---
 drivers/mtd/tests/subpagetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Weinberger June 1, 2017, 7:23 p.m. UTC | #1
On Thu, Jun 1, 2017 at 11:01 AM,  <xiaolei.li@mediatek.com> wrote:
> From: Xiaolei Li <xiaolei.li@mediatek.com>
>
> Write size in function write_eraseblock2 is subpgsize * k.
> It is wrong to check whether written is equal to subpgsize after each
> mtd_write.
>
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> ---
>  drivers/mtd/tests/subpagetest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/tests/subpagetest.c b/drivers/mtd/tests/subpagetest.c
> index aecc6ce..fa2519a 100644
> --- a/drivers/mtd/tests/subpagetest.c
> +++ b/drivers/mtd/tests/subpagetest.c
> @@ -102,7 +102,7 @@ static int write_eraseblock2(int ebnum)
>                 if (unlikely(err || written != subpgsize * k)) {
>                         pr_err("error: write failed at %#llx\n",
>                                (long long)addr);
> -                       if (written != subpgsize) {
> +                       if (written != subpgsize * k) {
>                                 pr_err("  write size: %#x\n",
>                                        subpgsize * k);
>                                 pr_err("  written: %#08zx\n",

Reviewed-by: Richard Weinberger <richard@nod.at>
Boris BREZILLON June 2, 2017, 7:14 a.m. UTC | #2
On Thu, 1 Jun 2017 17:01:19 +0800
<xiaolei.li@mediatek.com> wrote:

> From: Xiaolei Li <xiaolei.li@mediatek.com>
> 
> Write size in function write_eraseblock2 is subpgsize * k.
> It is wrong to check whether written is equal to subpgsize after each
> mtd_write.
> 
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/mtd/tests/subpagetest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/tests/subpagetest.c b/drivers/mtd/tests/subpagetest.c
> index aecc6ce..fa2519a 100644
> --- a/drivers/mtd/tests/subpagetest.c
> +++ b/drivers/mtd/tests/subpagetest.c
> @@ -102,7 +102,7 @@ static int write_eraseblock2(int ebnum)
>  		if (unlikely(err || written != subpgsize * k)) {
>  			pr_err("error: write failed at %#llx\n",
>  			       (long long)addr);
> -			if (written != subpgsize) {
> +			if (written != subpgsize * k) {
>  				pr_err("  write size: %#x\n",
>  				       subpgsize * k);
>  				pr_err("  written: %#08zx\n",
Brian Norris June 8, 2017, 11:43 p.m. UTC | #3
On Thu, Jun 01, 2017 at 05:01:19PM +0800, xiaolei.li@mediatek.com wrote:
> From: Xiaolei Li <xiaolei.li@mediatek.com>
> 
> Write size in function write_eraseblock2 is subpgsize * k.
> It is wrong to check whether written is equal to subpgsize after each
> mtd_write.
> 
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>

Applied to l2-mtd.git
diff mbox

Patch

diff --git a/drivers/mtd/tests/subpagetest.c b/drivers/mtd/tests/subpagetest.c
index aecc6ce..fa2519a 100644
--- a/drivers/mtd/tests/subpagetest.c
+++ b/drivers/mtd/tests/subpagetest.c
@@ -102,7 +102,7 @@  static int write_eraseblock2(int ebnum)
 		if (unlikely(err || written != subpgsize * k)) {
 			pr_err("error: write failed at %#llx\n",
 			       (long long)addr);
-			if (written != subpgsize) {
+			if (written != subpgsize * k) {
 				pr_err("  write size: %#x\n",
 				       subpgsize * k);
 				pr_err("  written: %#08zx\n",