aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/fastmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/fastmap.c')
-rw-r--r--drivers/mtd/ubi/fastmap.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index cfd5b5e90156..b56672bf3294 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -330,7 +330,7 @@ static int process_pool_aeb(struct ubi_device *ubi, struct ubi_attach_info *ai,
330 if (found) 330 if (found)
331 av = tmp_av; 331 av = tmp_av;
332 else { 332 else {
333 ubi_err("orphaned volume in fastmap pool!"); 333 ubi_err(ubi, "orphaned volume in fastmap pool!");
334 kmem_cache_free(ai->aeb_slab_cache, new_aeb); 334 kmem_cache_free(ai->aeb_slab_cache, new_aeb);
335 return UBI_BAD_FASTMAP; 335 return UBI_BAD_FASTMAP;
336 } 336 }
@@ -414,14 +414,14 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
414 pnum = be32_to_cpu(pebs[i]); 414 pnum = be32_to_cpu(pebs[i]);
415 415
416 if (ubi_io_is_bad(ubi, pnum)) { 416 if (ubi_io_is_bad(ubi, pnum)) {
417 ubi_err("bad PEB in fastmap pool!"); 417 ubi_err(ubi, "bad PEB in fastmap pool!");
418 ret = UBI_BAD_FASTMAP; 418 ret = UBI_BAD_FASTMAP;
419 goto out; 419 goto out;
420 } 420 }
421 421
422 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); 422 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
423 if (err && err != UBI_IO_BITFLIPS) { 423 if (err && err != UBI_IO_BITFLIPS) {
424 ubi_err("unable to read EC header! PEB:%i err:%i", 424 ubi_err(ubi, "unable to read EC header! PEB:%i err:%i",
425 pnum, err); 425 pnum, err);
426 ret = err > 0 ? UBI_BAD_FASTMAP : err; 426 ret = err > 0 ? UBI_BAD_FASTMAP : err;
427 goto out; 427 goto out;
@@ -435,7 +435,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
435 image_seq = be32_to_cpu(ech->image_seq); 435 image_seq = be32_to_cpu(ech->image_seq);
436 436
437 if (image_seq && (image_seq != ubi->image_seq)) { 437 if (image_seq && (image_seq != ubi->image_seq)) {
438 ubi_err("bad image seq: 0x%x, expected: 0x%x", 438 ubi_err(ubi, "bad image seq: 0x%x, expected: 0x%x",
439 be32_to_cpu(ech->image_seq), ubi->image_seq); 439 be32_to_cpu(ech->image_seq), ubi->image_seq);
440 ret = UBI_BAD_FASTMAP; 440 ret = UBI_BAD_FASTMAP;
441 goto out; 441 goto out;
@@ -493,7 +493,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
493 } 493 }
494 } else { 494 } else {
495 /* We are paranoid and fall back to scanning mode */ 495 /* We are paranoid and fall back to scanning mode */
496 ubi_err("fastmap pool PEBs contains damaged PEBs!"); 496 ubi_err(ubi, "fastmap pool PEBs contains damaged PEBs!");
497 ret = err > 0 ? UBI_BAD_FASTMAP : err; 497 ret = err > 0 ? UBI_BAD_FASTMAP : err;
498 goto out; 498 goto out;
499 } 499 }
@@ -588,7 +588,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
588 goto fail_bad; 588 goto fail_bad;
589 589
590 if (be32_to_cpu(fmhdr->magic) != UBI_FM_HDR_MAGIC) { 590 if (be32_to_cpu(fmhdr->magic) != UBI_FM_HDR_MAGIC) {
591 ubi_err("bad fastmap header magic: 0x%x, expected: 0x%x", 591 ubi_err(ubi, "bad fastmap header magic: 0x%x, expected: 0x%x",
592 be32_to_cpu(fmhdr->magic), UBI_FM_HDR_MAGIC); 592 be32_to_cpu(fmhdr->magic), UBI_FM_HDR_MAGIC);
593 goto fail_bad; 593 goto fail_bad;
594 } 594 }
@@ -598,7 +598,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
598 if (fm_pos >= fm_size) 598 if (fm_pos >= fm_size)
599 goto fail_bad; 599 goto fail_bad;
600 if (be32_to_cpu(fmpl1->magic) != UBI_FM_POOL_MAGIC) { 600 if (be32_to_cpu(fmpl1->magic) != UBI_FM_POOL_MAGIC) {
601 ubi_err("bad fastmap pool magic: 0x%x, expected: 0x%x", 601 ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x",
602 be32_to_cpu(fmpl1->magic), UBI_FM_POOL_MAGIC); 602 be32_to_cpu(fmpl1->magic), UBI_FM_POOL_MAGIC);
603 goto fail_bad; 603 goto fail_bad;
604 } 604 }
@@ -608,7 +608,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
608 if (fm_pos >= fm_size) 608 if (fm_pos >= fm_size)
609 goto fail_bad; 609 goto fail_bad;
610 if (be32_to_cpu(fmpl2->magic) != UBI_FM_POOL_MAGIC) { 610 if (be32_to_cpu(fmpl2->magic) != UBI_FM_POOL_MAGIC) {
611 ubi_err("bad fastmap pool magic: 0x%x, expected: 0x%x", 611 ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x",
612 be32_to_cpu(fmpl2->magic), UBI_FM_POOL_MAGIC); 612 be32_to_cpu(fmpl2->magic), UBI_FM_POOL_MAGIC);
613 goto fail_bad; 613 goto fail_bad;
614 } 614 }
@@ -619,25 +619,26 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
619 fm->max_wl_pool_size = be16_to_cpu(fmpl2->max_size); 619 fm->max_wl_pool_size = be16_to_cpu(fmpl2->max_size);
620 620
621 if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) { 621 if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) {
622 ubi_err("bad pool size: %i", pool_size); 622 ubi_err(ubi, "bad pool size: %i", pool_size);
623 goto fail_bad; 623 goto fail_bad;
624 } 624 }
625 625
626 if (wl_pool_size > UBI_FM_MAX_POOL_SIZE || wl_pool_size < 0) { 626 if (wl_pool_size > UBI_FM_MAX_POOL_SIZE || wl_pool_size < 0) {
627 ubi_err("bad WL pool size: %i", wl_pool_size); 627 ubi_err(ubi, "bad WL pool size: %i", wl_pool_size);
628 goto fail_bad; 628 goto fail_bad;
629 } 629 }
630 630
631 631
632 if (fm->max_pool_size > UBI_FM_MAX_POOL_SIZE || 632 if (fm->max_pool_size > UBI_FM_MAX_POOL_SIZE ||
633 fm->max_pool_size < 0) { 633 fm->max_pool_size < 0) {
634 ubi_err("bad maximal pool size: %i", fm->max_pool_size); 634 ubi_err(ubi, "bad maximal pool size: %i", fm->max_pool_size);
635 goto fail_bad; 635 goto fail_bad;
636 } 636 }
637 637
638 if (fm->max_wl_pool_size > UBI_FM_MAX_POOL_SIZE || 638 if (fm->max_wl_pool_size > UBI_FM_MAX_POOL_SIZE ||
639 fm->max_wl_pool_size < 0) { 639 fm->max_wl_pool_size < 0) {
640 ubi_err("bad maximal WL pool size: %i", fm->max_wl_pool_size); 640 ubi_err(ubi, "bad maximal WL pool size: %i",
641 fm->max_wl_pool_size);
641 goto fail_bad; 642 goto fail_bad;
642 } 643 }
643 644
@@ -696,8 +697,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
696 goto fail_bad; 697 goto fail_bad;
697 698
698 if (be32_to_cpu(fmvhdr->magic) != UBI_FM_VHDR_MAGIC) { 699 if (be32_to_cpu(fmvhdr->magic) != UBI_FM_VHDR_MAGIC) {
699 ubi_err("bad fastmap vol header magic: 0x%x, " \ 700 ubi_err(ubi, "bad fastmap vol header magic: 0x%x, expected: 0x%x",
700 "expected: 0x%x",
701 be32_to_cpu(fmvhdr->magic), UBI_FM_VHDR_MAGIC); 701 be32_to_cpu(fmvhdr->magic), UBI_FM_VHDR_MAGIC);
702 goto fail_bad; 702 goto fail_bad;
703 } 703 }
@@ -722,8 +722,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
722 goto fail_bad; 722 goto fail_bad;
723 723
724 if (be32_to_cpu(fm_eba->magic) != UBI_FM_EBA_MAGIC) { 724 if (be32_to_cpu(fm_eba->magic) != UBI_FM_EBA_MAGIC) {
725 ubi_err("bad fastmap EBA header magic: 0x%x, " \ 725 ubi_err(ubi, "bad fastmap EBA header magic: 0x%x, expected: 0x%x",
726 "expected: 0x%x",
727 be32_to_cpu(fm_eba->magic), UBI_FM_EBA_MAGIC); 726 be32_to_cpu(fm_eba->magic), UBI_FM_EBA_MAGIC);
728 goto fail_bad; 727 goto fail_bad;
729 } 728 }
@@ -788,7 +787,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
788 int err; 787 int err;
789 788
790 if (ubi_io_is_bad(ubi, tmp_aeb->pnum)) { 789 if (ubi_io_is_bad(ubi, tmp_aeb->pnum)) {
791 ubi_err("bad PEB in fastmap EBA orphan list"); 790 ubi_err(ubi, "bad PEB in fastmap EBA orphan list");
792 ret = UBI_BAD_FASTMAP; 791 ret = UBI_BAD_FASTMAP;
793 kfree(ech); 792 kfree(ech);
794 goto fail; 793 goto fail;
@@ -796,8 +795,8 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
796 795
797 err = ubi_io_read_ec_hdr(ubi, tmp_aeb->pnum, ech, 0); 796 err = ubi_io_read_ec_hdr(ubi, tmp_aeb->pnum, ech, 0);
798 if (err && err != UBI_IO_BITFLIPS) { 797 if (err && err != UBI_IO_BITFLIPS) {
799 ubi_err("unable to read EC header! PEB:%i " \ 798 ubi_err(ubi, "unable to read EC header! PEB:%i err:%i",
800 "err:%i", tmp_aeb->pnum, err); 799 tmp_aeb->pnum, err);
801 ret = err > 0 ? UBI_BAD_FASTMAP : err; 800 ret = err > 0 ? UBI_BAD_FASTMAP : err;
802 kfree(ech); 801 kfree(ech);
803 802
@@ -908,14 +907,14 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
908 fm->to_be_tortured[0] = 1; 907 fm->to_be_tortured[0] = 1;
909 908
910 if (be32_to_cpu(fmsb->magic) != UBI_FM_SB_MAGIC) { 909 if (be32_to_cpu(fmsb->magic) != UBI_FM_SB_MAGIC) {
911 ubi_err("bad super block magic: 0x%x, expected: 0x%x", 910 ubi_err(ubi, "bad super block magic: 0x%x, expected: 0x%x",
912 be32_to_cpu(fmsb->magic), UBI_FM_SB_MAGIC); 911 be32_to_cpu(fmsb->magic), UBI_FM_SB_MAGIC);
913 ret = UBI_BAD_FASTMAP; 912 ret = UBI_BAD_FASTMAP;
914 goto free_fm_sb; 913 goto free_fm_sb;
915 } 914 }
916 915
917 if (fmsb->version != UBI_FM_FMT_VERSION) { 916 if (fmsb->version != UBI_FM_FMT_VERSION) {
918 ubi_err("bad fastmap version: %i, expected: %i", 917 ubi_err(ubi, "bad fastmap version: %i, expected: %i",
919 fmsb->version, UBI_FM_FMT_VERSION); 918 fmsb->version, UBI_FM_FMT_VERSION);
920 ret = UBI_BAD_FASTMAP; 919 ret = UBI_BAD_FASTMAP;
921 goto free_fm_sb; 920 goto free_fm_sb;
@@ -923,15 +922,16 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
923 922
924 used_blocks = be32_to_cpu(fmsb->used_blocks); 923 used_blocks = be32_to_cpu(fmsb->used_blocks);
925 if (used_blocks > UBI_FM_MAX_BLOCKS || used_blocks < 1) { 924 if (used_blocks > UBI_FM_MAX_BLOCKS || used_blocks < 1) {
926 ubi_err("number of fastmap blocks is invalid: %i", used_blocks); 925 ubi_err(ubi, "number of fastmap blocks is invalid: %i",
926 used_blocks);
927 ret = UBI_BAD_FASTMAP; 927 ret = UBI_BAD_FASTMAP;
928 goto free_fm_sb; 928 goto free_fm_sb;
929 } 929 }
930 930
931 fm_size = ubi->leb_size * used_blocks; 931 fm_size = ubi->leb_size * used_blocks;
932 if (fm_size != ubi->fm_size) { 932 if (fm_size != ubi->fm_size) {
933 ubi_err("bad fastmap size: %zi, expected: %zi", fm_size, 933 ubi_err(ubi, "bad fastmap size: %zi, expected: %zi",
934 ubi->fm_size); 934 fm_size, ubi->fm_size);
935 ret = UBI_BAD_FASTMAP; 935 ret = UBI_BAD_FASTMAP;
936 goto free_fm_sb; 936 goto free_fm_sb;
937 } 937 }
@@ -960,7 +960,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
960 960
961 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); 961 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
962 if (ret && ret != UBI_IO_BITFLIPS) { 962 if (ret && ret != UBI_IO_BITFLIPS) {
963 ubi_err("unable to read fastmap block# %i EC (PEB: %i)", 963 ubi_err(ubi, "unable to read fastmap block# %i EC (PEB: %i)",
964 i, pnum); 964 i, pnum);
965 if (ret > 0) 965 if (ret > 0)
966 ret = UBI_BAD_FASTMAP; 966 ret = UBI_BAD_FASTMAP;
@@ -977,7 +977,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
977 * we shouldn't fail if image_seq == 0. 977 * we shouldn't fail if image_seq == 0.
978 */ 978 */
979 if (image_seq && (image_seq != ubi->image_seq)) { 979 if (image_seq && (image_seq != ubi->image_seq)) {
980 ubi_err("wrong image seq:%d instead of %d", 980 ubi_err(ubi, "wrong image seq:%d instead of %d",
981 be32_to_cpu(ech->image_seq), ubi->image_seq); 981 be32_to_cpu(ech->image_seq), ubi->image_seq);
982 ret = UBI_BAD_FASTMAP; 982 ret = UBI_BAD_FASTMAP;
983 goto free_hdr; 983 goto free_hdr;
@@ -985,15 +985,14 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
985 985
986 ret = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); 986 ret = ubi_io_read_vid_hdr(ubi, pnum, vh, 0);
987 if (ret && ret != UBI_IO_BITFLIPS) { 987 if (ret && ret != UBI_IO_BITFLIPS) {
988 ubi_err("unable to read fastmap block# %i (PEB: %i)", 988 ubi_err(ubi, "unable to read fastmap block# %i (PEB: %i)",
989 i, pnum); 989 i, pnum);
990 goto free_hdr; 990 goto free_hdr;
991 } 991 }
992 992
993 if (i == 0) { 993 if (i == 0) {
994 if (be32_to_cpu(vh->vol_id) != UBI_FM_SB_VOLUME_ID) { 994 if (be32_to_cpu(vh->vol_id) != UBI_FM_SB_VOLUME_ID) {
995 ubi_err("bad fastmap anchor vol_id: 0x%x," \ 995 ubi_err(ubi, "bad fastmap anchor vol_id: 0x%x, expected: 0x%x",
996 " expected: 0x%x",
997 be32_to_cpu(vh->vol_id), 996 be32_to_cpu(vh->vol_id),
998 UBI_FM_SB_VOLUME_ID); 997 UBI_FM_SB_VOLUME_ID);
999 ret = UBI_BAD_FASTMAP; 998 ret = UBI_BAD_FASTMAP;
@@ -1001,8 +1000,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
1001 } 1000 }
1002 } else { 1001 } else {
1003 if (be32_to_cpu(vh->vol_id) != UBI_FM_DATA_VOLUME_ID) { 1002 if (be32_to_cpu(vh->vol_id) != UBI_FM_DATA_VOLUME_ID) {
1004 ubi_err("bad fastmap data vol_id: 0x%x," \ 1003 ubi_err(ubi, "bad fastmap data vol_id: 0x%x, expected: 0x%x",
1005 " expected: 0x%x",
1006 be32_to_cpu(vh->vol_id), 1004 be32_to_cpu(vh->vol_id),
1007 UBI_FM_DATA_VOLUME_ID); 1005 UBI_FM_DATA_VOLUME_ID);
1008 ret = UBI_BAD_FASTMAP; 1006 ret = UBI_BAD_FASTMAP;
@@ -1016,7 +1014,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
1016 ret = ubi_io_read(ubi, ubi->fm_buf + (ubi->leb_size * i), pnum, 1014 ret = ubi_io_read(ubi, ubi->fm_buf + (ubi->leb_size * i), pnum,
1017 ubi->leb_start, ubi->leb_size); 1015 ubi->leb_start, ubi->leb_size);
1018 if (ret && ret != UBI_IO_BITFLIPS) { 1016 if (ret && ret != UBI_IO_BITFLIPS) {
1019 ubi_err("unable to read fastmap block# %i (PEB: %i, " \ 1017 ubi_err(ubi, "unable to read fastmap block# %i (PEB: %i, "
1020 "err: %i)", i, pnum, ret); 1018 "err: %i)", i, pnum, ret);
1021 goto free_hdr; 1019 goto free_hdr;
1022 } 1020 }
@@ -1030,8 +1028,9 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
1030 fmsb2->data_crc = 0; 1028 fmsb2->data_crc = 0;
1031 crc = crc32(UBI_CRC32_INIT, ubi->fm_buf, fm_size); 1029 crc = crc32(UBI_CRC32_INIT, ubi->fm_buf, fm_size);
1032 if (crc != tmp_crc) { 1030 if (crc != tmp_crc) {
1033 ubi_err("fastmap data CRC is invalid"); 1031 ubi_err(ubi, "fastmap data CRC is invalid");
1034 ubi_err("CRC should be: 0x%x, calc: 0x%x", tmp_crc, crc); 1032 ubi_err(ubi, "CRC should be: 0x%x, calc: 0x%x",
1033 tmp_crc, crc);
1035 ret = UBI_BAD_FASTMAP; 1034 ret = UBI_BAD_FASTMAP;
1036 goto free_hdr; 1035 goto free_hdr;
1037 } 1036 }
@@ -1067,9 +1066,10 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
1067 ubi->fm = fm; 1066 ubi->fm = fm;
1068 ubi->fm_pool.max_size = ubi->fm->max_pool_size; 1067 ubi->fm_pool.max_size = ubi->fm->max_pool_size;
1069 ubi->fm_wl_pool.max_size = ubi->fm->max_wl_pool_size; 1068 ubi->fm_wl_pool.max_size = ubi->fm->max_wl_pool_size;
1070 ubi_msg("attached by fastmap"); 1069 ubi_msg(ubi, "attached by fastmap");
1071 ubi_msg("fastmap pool size: %d", ubi->fm_pool.max_size); 1070 ubi_msg(ubi, "fastmap pool size: %d", ubi->fm_pool.max_size);
1072 ubi_msg("fastmap WL pool size: %d", ubi->fm_wl_pool.max_size); 1071 ubi_msg(ubi, "fastmap WL pool size: %d",
1072 ubi->fm_wl_pool.max_size);
1073 ubi->fm_disabled = 0; 1073 ubi->fm_disabled = 0;
1074 1074
1075 ubi_free_vid_hdr(ubi, vh); 1075 ubi_free_vid_hdr(ubi, vh);
@@ -1077,7 +1077,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
1077out: 1077out:
1078 mutex_unlock(&ubi->fm_mutex); 1078 mutex_unlock(&ubi->fm_mutex);
1079 if (ret == UBI_BAD_FASTMAP) 1079 if (ret == UBI_BAD_FASTMAP)
1080 ubi_err("Attach by fastmap failed, doing a full scan!"); 1080 ubi_err(ubi, "Attach by fastmap failed, doing a full scan!");
1081 return ret; 1081 return ret;
1082 1082
1083free_hdr: 1083free_hdr:
@@ -1273,7 +1273,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
1273 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum); 1273 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum);
1274 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avhdr); 1274 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avhdr);
1275 if (ret) { 1275 if (ret) {
1276 ubi_err("unable to write vid_hdr to fastmap SB!"); 1276 ubi_err(ubi, "unable to write vid_hdr to fastmap SB!");
1277 goto out_kfree; 1277 goto out_kfree;
1278 } 1278 }
1279 1279
@@ -1293,7 +1293,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
1293 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum)); 1293 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum));
1294 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvhdr); 1294 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvhdr);
1295 if (ret) { 1295 if (ret) {
1296 ubi_err("unable to write vid_hdr to PEB %i!", 1296 ubi_err(ubi, "unable to write vid_hdr to PEB %i!",
1297 new_fm->e[i]->pnum); 1297 new_fm->e[i]->pnum);
1298 goto out_kfree; 1298 goto out_kfree;
1299 } 1299 }
@@ -1303,7 +1303,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
1303 ret = ubi_io_write(ubi, fm_raw + (i * ubi->leb_size), 1303 ret = ubi_io_write(ubi, fm_raw + (i * ubi->leb_size),
1304 new_fm->e[i]->pnum, ubi->leb_start, ubi->leb_size); 1304 new_fm->e[i]->pnum, ubi->leb_start, ubi->leb_size);
1305 if (ret) { 1305 if (ret) {
1306 ubi_err("unable to write fastmap to PEB %i!", 1306 ubi_err(ubi, "unable to write fastmap to PEB %i!",
1307 new_fm->e[i]->pnum); 1307 new_fm->e[i]->pnum);
1308 goto out_kfree; 1308 goto out_kfree;
1309 } 1309 }
@@ -1450,7 +1450,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
1450 ubi->fm = NULL; 1450 ubi->fm = NULL;
1451 1451
1452 if (new_fm->used_blocks > UBI_FM_MAX_BLOCKS) { 1452 if (new_fm->used_blocks > UBI_FM_MAX_BLOCKS) {
1453 ubi_err("fastmap too large"); 1453 ubi_err(ubi, "fastmap too large");
1454 ret = -ENOSPC; 1454 ret = -ENOSPC;
1455 goto err; 1455 goto err;
1456 } 1456 }
@@ -1462,7 +1462,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
1462 1462
1463 if (!tmp_e && !old_fm) { 1463 if (!tmp_e && !old_fm) {
1464 int j; 1464 int j;
1465 ubi_err("could not get any free erase block"); 1465 ubi_err(ubi, "could not get any free erase block");
1466 1466
1467 for (j = 1; j < i; j++) 1467 for (j = 1; j < i; j++)
1468 ubi_wl_put_fm_peb(ubi, new_fm->e[j], j, 0); 1468 ubi_wl_put_fm_peb(ubi, new_fm->e[j], j, 0);
@@ -1478,7 +1478,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
1478 ubi_wl_put_fm_peb(ubi, new_fm->e[j], 1478 ubi_wl_put_fm_peb(ubi, new_fm->e[j],
1479 j, 0); 1479 j, 0);
1480 1480
1481 ubi_err("could not erase old fastmap PEB"); 1481 ubi_err(ubi, "could not erase old fastmap PEB");
1482 goto err; 1482 goto err;
1483 } 1483 }
1484 1484
@@ -1504,7 +1504,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
1504 ret = erase_block(ubi, old_fm->e[0]->pnum); 1504 ret = erase_block(ubi, old_fm->e[0]->pnum);
1505 if (ret < 0) { 1505 if (ret < 0) {
1506 int i; 1506 int i;
1507 ubi_err("could not erase old anchor PEB"); 1507 ubi_err(ubi, "could not erase old anchor PEB");
1508 1508
1509 for (i = 1; i < new_fm->used_blocks; i++) 1509 for (i = 1; i < new_fm->used_blocks; i++)
1510 ubi_wl_put_fm_peb(ubi, new_fm->e[i], 1510 ubi_wl_put_fm_peb(ubi, new_fm->e[i],
@@ -1525,7 +1525,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
1525 } else { 1525 } else {
1526 if (!tmp_e) { 1526 if (!tmp_e) {
1527 int i; 1527 int i;
1528 ubi_err("could not find any anchor PEB"); 1528 ubi_err(ubi, "could not find any anchor PEB");
1529 1529
1530 for (i = 1; i < new_fm->used_blocks; i++) 1530 for (i = 1; i < new_fm->used_blocks; i++)
1531 ubi_wl_put_fm_peb(ubi, new_fm->e[i], i, 0); 1531 ubi_wl_put_fm_peb(ubi, new_fm->e[i], i, 0);
@@ -1555,13 +1555,13 @@ out_unlock:
1555err: 1555err:
1556 kfree(new_fm); 1556 kfree(new_fm);
1557 1557
1558 ubi_warn("Unable to write new fastmap, err=%i", ret); 1558 ubi_warn(ubi, "Unable to write new fastmap, err=%i", ret);
1559 1559
1560 ret = 0; 1560 ret = 0;
1561 if (old_fm) { 1561 if (old_fm) {
1562 ret = invalidate_fastmap(ubi, old_fm); 1562 ret = invalidate_fastmap(ubi, old_fm);
1563 if (ret < 0) 1563 if (ret < 0)
1564 ubi_err("Unable to invalidiate current fastmap!"); 1564 ubi_err(ubi, "Unable to invalidiate current fastmap!");
1565 else if (ret) 1565 else if (ret)
1566 ret = 0; 1566 ret = 0;
1567 } 1567 }