diff mbox

mtd-utils: tests: Fix nandbiterrs Failure Check

Message ID 20170623230650.4669-1-harpreet@nestlabs.com
State Superseded
Delegated to: David Oberhollenzer
Headers show

Commit Message

harpreet@nestlabs.com June 23, 2017, 11:06 p.m. UTC
From: "Harpreet \"Eli\" Sangha" <harpreet@nestlabs.com>

After a page read, the old failure statistics are compared against the
new failure statistics before the new values are actually read.

Signed-off-by: Harpreet "Eli" Sangha
---
 tests/mtd-tests/nandbiterrs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Fabio Estevam June 27, 2017, 8:11 p.m. UTC | #1
On Fri, Jun 23, 2017 at 8:06 PM,  <harpreet@nestlabs.com> wrote:
> From: "Harpreet \"Eli\" Sangha" <harpreet@nestlabs.com>
>
> After a page read, the old failure statistics are compared against the
> new failure statistics before the new values are actually read.
>
> Signed-off-by: Harpreet "Eli" Sangha

Your email is missing in the Signed-off-by line.

Also them From and Signed-off-by lines should match.

Adding David on Cc.

Thanks

> ---
>  tests/mtd-tests/nandbiterrs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/mtd-tests/nandbiterrs.c b/tests/mtd-tests/nandbiterrs.c
> index 6acbfee..de9d0dd 100644
> --- a/tests/mtd-tests/nandbiterrs.c
> +++ b/tests/mtd-tests/nandbiterrs.c
> @@ -268,15 +268,15 @@ static int read_page(void)
>                 return -1;
>         }
>
> +       if (ioctl(fd, ECCGETSTATS, &new) != 0)
> +               goto failstats;
> +
>         if (new.failed > old.failed) {
>                 fprintf(stderr, "Failed to recover %d bitflips\n",
>                                 new.failed - old.failed);
>                 return -1;
>         }
>
> -       if (ioctl(fd, ECCGETSTATS, &new) != 0)
> -               goto failstats;
> -
>         return new.corrected - old.corrected;
>  failstats:
>         perror("ECCGETSTATS");
> --
> 2.13.1.611.g7e3b11ae1-goog
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
diff mbox

Patch

diff --git a/tests/mtd-tests/nandbiterrs.c b/tests/mtd-tests/nandbiterrs.c
index 6acbfee..de9d0dd 100644
--- a/tests/mtd-tests/nandbiterrs.c
+++ b/tests/mtd-tests/nandbiterrs.c
@@ -268,15 +268,15 @@  static int read_page(void)
 		return -1;
 	}
 
+	if (ioctl(fd, ECCGETSTATS, &new) != 0)
+		goto failstats;
+
 	if (new.failed > old.failed) {
 		fprintf(stderr, "Failed to recover %d bitflips\n",
 				new.failed - old.failed);
 		return -1;
 	}
 
-	if (ioctl(fd, ECCGETSTATS, &new) != 0)
-		goto failstats;
-
 	return new.corrected - old.corrected;
 failstats:
 	perror("ECCGETSTATS");