Patchwork Don't verify after a failed write

login
register
about
Submitter Carl-Daniel Hailfinger
Date 2009-07-23 22:41:05
Message ID <4A68E701.6080300@gmx.net>
Download mbox | patch
Permalink /patch/72/
State Accepted
Commit r666
Headers show

Comments

Carl-Daniel Hailfinger - 2009-07-23 22:41:05
If writing failed, verifying is pointless. Abort instead.

On 23.07.2009 22:46, Oliver Niesner wrote:
> Writing flash chip... ERASE FAILED at 0x00000000! Expected=0xff, Read=0x49, failed byte count from 0x00000000-0x0007ffff: 0x45d42
> ERASE FAILED!
> ERASE FAILED!
> Verifying flash... VERIFY FAILED at 0x00000000! Expected=0x21, Read=0x49, failed byte count from 0x00000000-0x0007ffff: 0x6bf33
>   


Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Oliver Niesner - 2009-07-24 10:09:03
Carl-Daniel Hailfinger schrieb:
> If writing failed, verifying is pointless. Abort instead.
> 
> On 23.07.2009 22:46, Oliver Niesner wrote:
>> Writing flash chip... ERASE FAILED at 0x00000000! Expected=0xff, Read=0x49, failed byte count from 0x00000000-0x0007ffff: 0x45d42
>> ERASE FAILED!
>> ERASE FAILED!
>> Verifying flash... VERIFY FAILED at 0x00000000! Expected=0x21, Read=0x49, failed byte count from 0x00000000-0x0007ffff: 0x6bf33
>>   
> 
> 
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
> 
> Index: flashrom-no_verify_after_failed_write/flashrom.c
> ===================================================================
> --- flashrom-no_verify_after_failed_write/flashrom.c	(Revision 665)
> +++ flashrom-no_verify_after_failed_write/flashrom.c	(Arbeitskopie)
> @@ -851,12 +851,17 @@
>  			fprintf(stderr, "Error: flashrom has no write function for this flash chip.\n");
>  			return 1;
>  		}
> -		ret |= flash->write(flash, buf);
> -		if (!ret) printf("COMPLETE.\n");
> +		ret = flash->write(flash, buf);
> +		if (ret) {
> +			fprintf(stderr, "FAILED!\n");
> +			return 1;
> +		} else {
> +			printf("COMPLETE.\n");
> +		}
>  	}
>  
>  	if (verify_it)
> -		ret |= verify_flash(flash, buf);
> +		ret = verify_flash(flash, buf);
>  
>  	programmer_shutdown();
>  
> 
> 

Acked-by: Oliver Niesner oli@rhce.servebbs.net
Carl-Daniel Hailfinger - 2009-07-24 12:19:38
On 24.07.2009 12:09, Oliver Niesner wrote:
> Carl-Daniel Hailfinger schrieb:
>   
>> If writing failed, verifying is pointless. Abort instead.
>>     
>> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
>>
>>     
> Acked-by: Oliver Niesner oli@rhce.servebbs.net
>   

Thanks, r666.

Regards,
Carl-Daniel

Patch

Index: flashrom-no_verify_after_failed_write/flashrom.c
===================================================================
--- flashrom-no_verify_after_failed_write/flashrom.c	(Revision 665)
+++ flashrom-no_verify_after_failed_write/flashrom.c	(Arbeitskopie)
@@ -851,12 +851,17 @@ 
 			fprintf(stderr, "Error: flashrom has no write function for this flash chip.\n");
 			return 1;
 		}
-		ret |= flash->write(flash, buf);
-		if (!ret) printf("COMPLETE.\n");
+		ret = flash->write(flash, buf);
+		if (ret) {
+			fprintf(stderr, "FAILED!\n");
+			return 1;
+		} else {
+			printf("COMPLETE.\n");
+		}
 	}
 
 	if (verify_it)
-		ret |= verify_flash(flash, buf);
+		ret = verify_flash(flash, buf);
 
 	programmer_shutdown();