Lines Matching refs:err
125 int err, retries = 0; in ubi_io_read() local
135 err = self_check_not_bad(ubi, pnum); in ubi_io_read()
136 if (err) in ubi_io_read()
137 return err; in ubi_io_read()
163 err = mtd_read(ubi->mtd, addr, len, &read, buf); in ubi_io_read()
164 if (err) { in ubi_io_read()
165 const char *errstr = mtd_is_eccerr(err) ? " (ECC error)" : ""; in ubi_io_read()
167 if (mtd_is_bitflip(err)) { in ubi_io_read()
184 err, errstr, len, pnum, offset, read); in ubi_io_read()
190 err, errstr, len, pnum, offset, read); in ubi_io_read()
198 if (read != len && mtd_is_eccerr(err)) { in ubi_io_read()
200 err = -EIO; in ubi_io_read()
207 err = UBI_IO_BITFLIPS; in ubi_io_read()
211 return err; in ubi_io_read()
234 int err; in ubi_io_write() local
250 err = self_check_not_bad(ubi, pnum); in ubi_io_write()
251 if (err) in ubi_io_write()
252 return err; in ubi_io_write()
255 err = ubi_self_check_all_ff(ubi, pnum, offset, len); in ubi_io_write()
256 if (err) in ubi_io_write()
257 return err; in ubi_io_write()
264 err = self_check_peb_ec_hdr(ubi, pnum); in ubi_io_write()
265 if (err) in ubi_io_write()
266 return err; in ubi_io_write()
267 err = self_check_peb_vid_hdr(ubi, pnum); in ubi_io_write()
268 if (err) in ubi_io_write()
269 return err; in ubi_io_write()
280 err = mtd_write(ubi->mtd, addr, len, &written, buf); in ubi_io_write()
281 if (err) { in ubi_io_write()
283 err, len, pnum, offset, written); in ubi_io_write()
289 if (!err) { in ubi_io_write()
290 err = self_check_write(ubi, buf, pnum, offset, len); in ubi_io_write()
291 if (err) in ubi_io_write()
292 return err; in ubi_io_write()
301 err = ubi_self_check_all_ff(ubi, pnum, offset, len); in ubi_io_write()
304 return err; in ubi_io_write()
330 int err, retries = 0; in do_sync_erase() local
352 err = mtd_erase(ubi->mtd, &ei); in do_sync_erase()
353 if (err) { in do_sync_erase()
356 err, pnum); in do_sync_erase()
360 ubi_err(ubi, "cannot erase PEB %d, error %d", pnum, err); in do_sync_erase()
362 return err; in do_sync_erase()
365 err = wait_event_interruptible(wq, ei.state == MTD_ERASE_DONE || in do_sync_erase()
367 if (err) { in do_sync_erase()
384 err = ubi_self_check_all_ff(ubi, pnum, 0, ubi->peb_size); in do_sync_erase()
385 if (err) in do_sync_erase()
386 return err; in do_sync_erase()
410 int err, i, patt_count; in torture_peb() local
418 err = do_sync_erase(ubi, pnum); in torture_peb()
419 if (err) in torture_peb()
423 err = ubi_io_read(ubi, ubi->peb_buf, pnum, 0, ubi->peb_size); in torture_peb()
424 if (err) in torture_peb()
427 err = ubi_check_pattern(ubi->peb_buf, 0xFF, ubi->peb_size); in torture_peb()
428 if (err == 0) { in torture_peb()
431 err = -EIO; in torture_peb()
437 err = ubi_io_write(ubi, ubi->peb_buf, pnum, 0, ubi->peb_size); in torture_peb()
438 if (err) in torture_peb()
442 err = ubi_io_read(ubi, ubi->peb_buf, pnum, 0, ubi->peb_size); in torture_peb()
443 if (err) in torture_peb()
446 err = ubi_check_pattern(ubi->peb_buf, patterns[i], in torture_peb()
448 if (err == 0) { in torture_peb()
451 err = -EIO; in torture_peb()
456 err = patt_count; in torture_peb()
461 if (err == UBI_IO_BITFLIPS || mtd_is_eccerr(err)) { in torture_peb()
469 err = -EIO; in torture_peb()
471 return err; in torture_peb()
496 int err; in nor_erase_prepare() local
519 err = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0); in nor_erase_prepare()
520 if (err != UBI_IO_BAD_HDR_EBADMSG && err != UBI_IO_BAD_HDR && in nor_erase_prepare()
521 err != UBI_IO_FF){ in nor_erase_prepare()
522 err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data); in nor_erase_prepare()
523 if(err) in nor_erase_prepare()
527 err = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); in nor_erase_prepare()
528 if (err != UBI_IO_BAD_HDR_EBADMSG && err != UBI_IO_BAD_HDR && in nor_erase_prepare()
529 err != UBI_IO_FF){ in nor_erase_prepare()
531 err = mtd_write(ubi->mtd, addr, 4, &written, (void *)&data); in nor_erase_prepare()
532 if (err) in nor_erase_prepare()
543 ubi_err(ubi, "cannot invalidate PEB %d, write returned %d", pnum, err); in nor_erase_prepare()
566 int err, ret = 0; in ubi_io_sync_erase() local
570 err = self_check_not_bad(ubi, pnum); in ubi_io_sync_erase()
571 if (err != 0) in ubi_io_sync_erase()
572 return err; in ubi_io_sync_erase()
580 err = nor_erase_prepare(ubi, pnum); in ubi_io_sync_erase()
581 if (err) in ubi_io_sync_erase()
582 return err; in ubi_io_sync_erase()
591 err = do_sync_erase(ubi, pnum); in ubi_io_sync_erase()
592 if (err) in ubi_io_sync_erase()
593 return err; in ubi_io_sync_erase()
637 int err; in ubi_io_mark_bad() local
650 err = mtd_block_markbad(mtd, (loff_t)pnum * ubi->peb_size); in ubi_io_mark_bad()
651 if (err) in ubi_io_mark_bad()
652 ubi_err(ubi, "cannot mark PEB %d bad, error %d", pnum, err); in ubi_io_mark_bad()
653 return err; in ubi_io_mark_bad()
731 int err, read_err; in ubi_io_read_ec_hdr() local
809 err = validate_ec_hdr(ubi, ec_hdr); in ubi_io_read_ec_hdr()
810 if (err) { in ubi_io_read_ec_hdr()
840 int err; in ubi_io_write_ec_hdr() local
854 err = self_check_ec_hdr(ubi, pnum, ec_hdr); in ubi_io_write_ec_hdr()
855 if (err) in ubi_io_write_ec_hdr()
856 return err; in ubi_io_write_ec_hdr()
861 err = ubi_io_write(ubi, ec_hdr, pnum, 0, ubi->ec_hdr_alsize); in ubi_io_write_ec_hdr()
862 return err; in ubi_io_write_ec_hdr()
1004 int err, read_err; in ubi_io_read_vid_hdr() local
1061 err = validate_vid_hdr(ubi, vid_hdr); in ubi_io_read_vid_hdr()
1062 if (err) { in ubi_io_read_vid_hdr()
1088 int err; in ubi_io_write_vid_hdr() local
1095 err = self_check_peb_ec_hdr(ubi, pnum); in ubi_io_write_vid_hdr()
1096 if (err) in ubi_io_write_vid_hdr()
1097 return err; in ubi_io_write_vid_hdr()
1104 err = self_check_vid_hdr(ubi, pnum, vid_hdr); in ubi_io_write_vid_hdr()
1105 if (err) in ubi_io_write_vid_hdr()
1106 return err; in ubi_io_write_vid_hdr()
1112 err = ubi_io_write(ubi, p, pnum, ubi->vid_hdr_aloffset, in ubi_io_write_vid_hdr()
1114 return err; in ubi_io_write_vid_hdr()
1127 int err; in self_check_not_bad() local
1132 err = ubi_io_is_bad(ubi, pnum); in self_check_not_bad()
1133 if (!err) in self_check_not_bad()
1134 return err; in self_check_not_bad()
1138 return err > 0 ? -EINVAL : err; in self_check_not_bad()
1153 int err; in self_check_ec_hdr() local
1166 err = validate_ec_hdr(ubi, ec_hdr); in self_check_ec_hdr()
1167 if (err) { in self_check_ec_hdr()
1190 int err; in self_check_peb_ec_hdr() local
1201 err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE); in self_check_peb_ec_hdr()
1202 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err)) in self_check_peb_ec_hdr()
1213 err = -EINVAL; in self_check_peb_ec_hdr()
1217 err = self_check_ec_hdr(ubi, pnum, ec_hdr); in self_check_peb_ec_hdr()
1221 return err; in self_check_peb_ec_hdr()
1236 int err; in self_check_vid_hdr() local
1249 err = validate_vid_hdr(ubi, vid_hdr); in self_check_vid_hdr()
1250 if (err) { in self_check_vid_hdr()
1255 return err; in self_check_vid_hdr()
1275 int err; in self_check_peb_vid_hdr() local
1288 err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, in self_check_peb_vid_hdr()
1290 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err)) in self_check_peb_vid_hdr()
1301 err = -EINVAL; in self_check_peb_vid_hdr()
1305 err = self_check_vid_hdr(ubi, pnum, vid_hdr); in self_check_peb_vid_hdr()
1309 return err; in self_check_peb_vid_hdr()
1327 int err, i; in self_check_write() local
1341 err = mtd_read(ubi->mtd, addr, len, &read, buf1); in self_check_write()
1342 if (err && !mtd_is_bitflip(err)) in self_check_write()
1369 err = -EINVAL; in self_check_write()
1378 return err; in self_check_write()
1395 int err; in ubi_self_check_all_ff() local
1408 err = mtd_read(ubi->mtd, addr, len, &read, buf); in ubi_self_check_all_ff()
1409 if (err && !mtd_is_bitflip(err)) { in ubi_self_check_all_ff()
1411 err, len, pnum, offset, read); in ubi_self_check_all_ff()
1415 err = ubi_check_pattern(buf, 0xFF, len); in ubi_self_check_all_ff()
1416 if (err == 0) { in ubi_self_check_all_ff()
1429 err = -EINVAL; in ubi_self_check_all_ff()
1433 return err; in ubi_self_check_all_ff()