Lines Matching refs:ret

28 	int *ret;  in init_seen()  local
33 ret = kcalloc(ubi->peb_count, sizeof(int), GFP_KERNEL); in init_seen()
34 if (!ret) in init_seen()
37 return ret; in init_seen()
70 int pnum, ret = 0; in self_check_seen() local
78 ret = -EINVAL; in self_check_seen()
82 return ret; in self_check_seen()
467 int i, pnum, err, ret = 0; in scan_pool() local
493 ret = UBI_BAD_FASTMAP; in scan_pool()
501 ret = err > 0 ? UBI_BAD_FASTMAP : err; in scan_pool()
515 ret = UBI_BAD_FASTMAP; in scan_pool()
538 ret = -ENOMEM; in scan_pool()
554 ret = err > 0 ? UBI_BAD_FASTMAP : err; in scan_pool()
560 ret = err > 0 ? UBI_BAD_FASTMAP : err; in scan_pool()
569 return ret; in scan_pool()
618 int ret, i, j, pool_size, wl_pool_size; in ubi_attach_fastmap() local
814 ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, &max_sqnum, &free); in ubi_attach_fastmap()
815 if (ret) in ubi_attach_fastmap()
818 ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, &max_sqnum, &free); in ubi_attach_fastmap()
819 if (ret) in ubi_attach_fastmap()
854 ret = UBI_BAD_FASTMAP; in ubi_attach_fastmap()
865 return ret; in ubi_attach_fastmap()
885 int i, used_blocks, pnum, ret = 0; in ubi_scan_fastmap() local
895 ret = -ENOMEM; in ubi_scan_fastmap()
901 ret = -ENOMEM; in ubi_scan_fastmap()
906 ret = ubi_io_read(ubi, fmsb, fm_anchor, ubi->leb_start, sizeof(*fmsb)); in ubi_scan_fastmap()
907 if (ret && ret != UBI_IO_BITFLIPS) in ubi_scan_fastmap()
909 else if (ret == UBI_IO_BITFLIPS) in ubi_scan_fastmap()
915 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
922 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
930 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
938 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
944 ret = -ENOMEM; in ubi_scan_fastmap()
950 ret = -ENOMEM; in ubi_scan_fastmap()
960 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
964 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in ubi_scan_fastmap()
965 if (ret && ret != UBI_IO_BITFLIPS) { in ubi_scan_fastmap()
968 if (ret > 0) in ubi_scan_fastmap()
969 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
971 } else if (ret == UBI_IO_BITFLIPS) in ubi_scan_fastmap()
985 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
989 ret = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); in ubi_scan_fastmap()
990 if (ret && ret != UBI_IO_BITFLIPS) { in ubi_scan_fastmap()
1001 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
1009 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
1017 ret = ubi_io_read(ubi, ubi->fm_buf + (ubi->leb_size * i), pnum, in ubi_scan_fastmap()
1019 if (ret && ret != UBI_IO_BITFLIPS) { in ubi_scan_fastmap()
1021 "err: %i)", i, pnum, ret); in ubi_scan_fastmap()
1037 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
1045 ret = ubi_attach_fastmap(ubi, ai, fm); in ubi_scan_fastmap()
1046 if (ret) { in ubi_scan_fastmap()
1047 if (ret > 0) in ubi_scan_fastmap()
1048 ret = UBI_BAD_FASTMAP; in ubi_scan_fastmap()
1060 ret = -ENOMEM; in ubi_scan_fastmap()
1082 if (ret == UBI_BAD_FASTMAP) in ubi_scan_fastmap()
1084 return ret; in ubi_scan_fastmap()
1118 int ret, i, j, free_peb_count, used_peb_count, vol_count; in ubi_write_fastmap() local
1127 ret = -ENOMEM; in ubi_write_fastmap()
1133 ret = -ENOMEM; in ubi_write_fastmap()
1139 ret = PTR_ERR(seen_pebs); in ubi_write_fastmap()
1301 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avhdr); in ubi_write_fastmap()
1302 if (ret) { in ubi_write_fastmap()
1322 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvhdr); in ubi_write_fastmap()
1323 if (ret) { in ubi_write_fastmap()
1331 ret = ubi_io_write(ubi, fm_raw + (i * ubi->leb_size), in ubi_write_fastmap()
1333 if (ret) { in ubi_write_fastmap()
1343 ret = self_check_seen(ubi, seen_pebs); in ubi_write_fastmap()
1351 return ret; in ubi_write_fastmap()
1363 int ret; in erase_block() local
1371 ret = ubi_io_read_ec_hdr(ubi, pnum, ec_hdr, 0); in erase_block()
1372 if (ret < 0) in erase_block()
1374 else if (ret && ret != UBI_IO_BITFLIPS) { in erase_block()
1375 ret = -EINVAL; in erase_block()
1379 ret = ubi_io_sync_erase(ubi, pnum, 0); in erase_block()
1380 if (ret < 0) in erase_block()
1384 ec += ret; in erase_block()
1386 ret = -EINVAL; in erase_block()
1391 ret = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr); in erase_block()
1392 if (ret < 0) in erase_block()
1395 ret = ec; in erase_block()
1398 return ret; in erase_block()
1415 int ret; in invalidate_fastmap() local
1425 ret = -ENOMEM; in invalidate_fastmap()
1434 ret = -ENOSPC; in invalidate_fastmap()
1444 ret = ubi_io_write_vid_hdr(ubi, e->pnum, vh); in invalidate_fastmap()
1445 if (ret < 0) { in invalidate_fastmap()
1457 return ret; in invalidate_fastmap()
1496 int ret, i, j; in ubi_update_fastmap() local
1509 ret = ubi_ensure_anchor_pebs(ubi); in ubi_update_fastmap()
1510 if (ret) { in ubi_update_fastmap()
1512 return ret; in ubi_update_fastmap()
1527 ret = -ENOSPC; in ubi_update_fastmap()
1538 ret = erase_block(ubi, old_fm->e[i]->pnum); in ubi_update_fastmap()
1539 if (ret < 0) { in ubi_update_fastmap()
1559 ret = -ENOSPC; in ubi_update_fastmap()
1589 ret = erase_block(ubi, old_fm->e[0]->pnum); in ubi_update_fastmap()
1590 if (ret < 0) { in ubi_update_fastmap()
1601 new_fm->e[0]->ec = ret; in ubi_update_fastmap()
1619 ret = -ENOSPC; in ubi_update_fastmap()
1627 ret = ubi_write_fastmap(ubi, new_fm); in ubi_update_fastmap()
1631 if (ret) in ubi_update_fastmap()
1637 return ret; in ubi_update_fastmap()
1640 ubi_warn(ubi, "Unable to write new fastmap, err=%i", ret); in ubi_update_fastmap()
1642 ret = invalidate_fastmap(ubi); in ubi_update_fastmap()
1643 if (ret < 0) { in ubi_update_fastmap()
1649 ret = 0; in ubi_update_fastmap()