On 01.12.2010 11:12, Michael Karcher wrote:
> Am Dienstag, den 30.11.2010, 01:42 +0100 schrieb Carl-Daniel Hailfinger:
>   
>> Handle erase failure in partial write.
>> Clean up erase function checking.
>> Update a few comments and messages to improve readability.
>>     
> Reviewing would be easier of course if the first one would be a separate
> patch from the second and third one, but as it seems they don't overlap,
> it's OK, too.
>   

Noted.


> Acked-by: Michael Karcher <[email protected]>
>   

Thanks for your review! I split the patch as suggested.

Handle erase failure in partial write.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>
Acked-by: Michael Karcher <[email protected]>

Index: flashrom-handle_failed_erase_or_write/flashrom.c
===================================================================
--- flashrom-handle_failed_erase_or_write/flashrom.c    (Revision 1236)
+++ flashrom-handle_failed_erase_or_write/flashrom.c    (Arbeitskopie)
@@ -1468,11 +1468,20 @@
                /* If everything is OK, don't try another erase function. */
                if (!ret)
                        break;
-               /* FIXME: Reread the whole chip here so we know the current
-                * chip contents? curcontents might be up to date, but this
-                * code is only reached if something failed, and then we don't
-                * know exactly what failed, and how.
+               /* Write/erase failed, so try to find out what the current chip
+                * contents are. If no usable erase functions remain, we could
+                * abort the loop instead of continuing, the effect is the same.
+                * The only difference is whether the reason for other unusable
+                * functions is printed or not. If in doubt, verbosity wins.
                 */
+               if (flash->read(flash, curcontents, 0, size)) {
+                       /* Now we are truly screwed. Read failed as well. */
+                       msg_cerr("Can't read anymore!\n");
+                       /* We have no idea about the flash chip contents, so
+                        * retrying with another erase function is pointless.
+                        */
+                       break;
+               }
        }
        /* Free the scratchpad. */
        free(curcontents);


-- 
http://www.hailfinger.org/


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to