xiaoxiang781216 commented on code in PR #9154:
URL: https://github.com/apache/nuttx/pull/9154#discussion_r1183571352


##########
drivers/mtd/mtd_nand.c:
##########
@@ -600,7 +624,11 @@ static ssize_t nand_bread(FAR struct mtd_dev_s *dev, off_t 
startpage,
       /* Read the next page from NAND */
 
       ret = nand_readpage(nand, block, page, buffer);
-      if (ret < 0)
+      if (ret == -EUCLEAN)
+        {
+          fixedecc = true;
+        }
+      else if (ret < 0)
         {
           ferr("ERROR: nand_readpage failed block=%ld page=%d: %d\n",
                (long)block, page, ret);

Review Comment:
   Done.



##########
drivers/mtd/mtd_nandecc.c:
##########
@@ -138,14 +138,19 @@ int nandecc_readpage(FAR struct nand_dev_s *nand, off_t 
block,
   /* Use the ECC data to verify the page */
 
   ret = hamming_verify256x(data, pagesize, raw->ecc);
-  if (ret && (ret != HAMMING_ERROR_SINGLEBIT))
+  switch (ret)
     {
+      case HAMMING_SUCCESS:
+        return OK;
+
+      case HAMMING_ERROR_SINGLEBIT:
+        return -EUCLEAN;
+
+      default:
       ferr("ERROR: Block=%d page=%d Unrecoverable error: %d\n",

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to