| .. | .. |
|---|
| 153 | 153 | mtdblk->cache_state = STATE_EMPTY; |
|---|
| 154 | 154 | ret = mtd_read(mtd, sect_start, sect_size, |
|---|
| 155 | 155 | &retlen, mtdblk->cache_data); |
|---|
| 156 | | - if (ret) |
|---|
| 156 | + if (ret && !mtd_is_bitflip(ret)) |
|---|
| 157 | 157 | return ret; |
|---|
| 158 | 158 | if (retlen != sect_size) |
|---|
| 159 | 159 | return -EIO; |
|---|
| .. | .. |
|---|
| 188 | 188 | pr_debug("mtdblock: read on \"%s\" at 0x%lx, size 0x%x\n", |
|---|
| 189 | 189 | mtd->name, pos, len); |
|---|
| 190 | 190 | |
|---|
| 191 | | - if (!sect_size) |
|---|
| 192 | | - return mtd_read(mtd, pos, len, &retlen, buf); |
|---|
| 191 | + if (!sect_size) { |
|---|
| 192 | + ret = mtd_read(mtd, pos, len, &retlen, buf); |
|---|
| 193 | + if (ret && !mtd_is_bitflip(ret)) |
|---|
| 194 | + return ret; |
|---|
| 195 | + return 0; |
|---|
| 196 | + } |
|---|
| 193 | 197 | |
|---|
| 194 | 198 | while (len > 0) { |
|---|
| 195 | 199 | unsigned long sect_start = (pos/sect_size)*sect_size; |
|---|
| .. | .. |
|---|
| 209 | 213 | memcpy (buf, mtdblk->cache_data + offset, size); |
|---|
| 210 | 214 | } else { |
|---|
| 211 | 215 | ret = mtd_read(mtd, pos, size, &retlen, buf); |
|---|
| 212 | | - if (ret) |
|---|
| 216 | + if (ret && !mtd_is_bitflip(ret)) |
|---|
| 213 | 217 | return ret; |
|---|
| 214 | 218 | if (retlen != size) |
|---|
| 215 | 219 | return -EIO; |
|---|