OneNAND: Don't write if it exceeds the partition
authorKyungmin Park <kyungmin.park@samsung.com>
Tue, 2 Feb 2010 04:44:56 +0000 (13:44 +0900)
committerKyungmin Park <kyungmin.park@samsung.com>
Tue, 2 Feb 2010 04:44:56 +0000 (13:44 +0900)
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
common/cmd_onenand.c

index 8b0741a..bf76610 100644 (file)
@@ -86,7 +86,6 @@ static int onenand_block_read(loff_t from, ssize_t len,
                        printk("Bad blocks %d at 0x%x\n",
                               (u32)(ofs >> this->erase_shift), (u32)ofs);
                        ofs += blocksize;
-                       /* FIXME need to check how to handle the 'len' */
                        len -= blocksize;
                        continue;
                }
@@ -146,6 +145,7 @@ static int onenand_block_write(loff_t to, ssize_t len,
                        printk("Bad blocks %d at 0x%x\n",
                               (u32)(ofs >> this->erase_shift), (u32)ofs);
                        skip_ofs += blocksize;
+                       len -= blocksize;
                        goto next;
                }