diff options
-rw-r--r-- | drivers/mtd/ubi/build.c | 28 | ||||
-rw-r--r-- | drivers/mtd/ubi/eba.c | 70 | ||||
-rw-r--r-- | drivers/mtd/ubi/io.c | 66 | ||||
-rw-r--r-- | drivers/mtd/ubi/scan.c | 19 | ||||
-rw-r--r-- | drivers/mtd/ubi/scan.h | 8 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 30 | ||||
-rw-r--r-- | drivers/mtd/ubi/vtbl.c | 6 | ||||
-rw-r--r-- | drivers/mtd/ubi/wl.c | 4 |
8 files changed, 119 insertions, 112 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 1cb22bfae750..023653977a1a 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -565,7 +565,7 @@ static int attach_mtd_dev(const char *mtd_dev, int vid_hdr_offset, | |||
565 | } | 565 | } |
566 | 566 | ||
567 | ubi = ubi_devices[ubi_devices_cnt] = kzalloc(sizeof(struct ubi_device), | 567 | ubi = ubi_devices[ubi_devices_cnt] = kzalloc(sizeof(struct ubi_device), |
568 | GFP_KERNEL); | 568 | GFP_KERNEL); |
569 | if (!ubi) { | 569 | if (!ubi) { |
570 | err = -ENOMEM; | 570 | err = -ENOMEM; |
571 | goto out_mtd; | 571 | goto out_mtd; |
@@ -583,6 +583,22 @@ static int attach_mtd_dev(const char *mtd_dev, int vid_hdr_offset, | |||
583 | if (err) | 583 | if (err) |
584 | goto out_free; | 584 | goto out_free; |
585 | 585 | ||
586 | mutex_init(&ubi->buf_mutex); | ||
587 | ubi->peb_buf1 = vmalloc(ubi->peb_size); | ||
588 | if (!ubi->peb_buf1) | ||
589 | goto out_free; | ||
590 | |||
591 | ubi->peb_buf2 = vmalloc(ubi->peb_size); | ||
592 | if (!ubi->peb_buf2) | ||
593 | goto out_free; | ||
594 | |||
595 | #ifdef CONFIG_MTD_UBI_DEBUG | ||
596 | mutex_init(&ubi->dbg_buf_mutex); | ||
597 | ubi->dbg_peb_buf = vmalloc(ubi->peb_size); | ||
598 | if (!ubi->dbg_peb_buf) | ||
599 | goto out_free; | ||
600 | #endif | ||
601 | |||
586 | err = attach_by_scanning(ubi); | 602 | err = attach_by_scanning(ubi); |
587 | if (err) { | 603 | if (err) { |
588 | dbg_err("failed to attach by scanning, error %d", err); | 604 | dbg_err("failed to attach by scanning, error %d", err); |
@@ -630,6 +646,11 @@ out_detach: | |||
630 | ubi_wl_close(ubi); | 646 | ubi_wl_close(ubi); |
631 | vfree(ubi->vtbl); | 647 | vfree(ubi->vtbl); |
632 | out_free: | 648 | out_free: |
649 | vfree(ubi->peb_buf1); | ||
650 | vfree(ubi->peb_buf2); | ||
651 | #ifdef CONFIG_MTD_UBI_DEBUG | ||
652 | vfree(ubi->dbg_peb_buf); | ||
653 | #endif | ||
633 | kfree(ubi); | 654 | kfree(ubi); |
634 | out_mtd: | 655 | out_mtd: |
635 | put_mtd_device(mtd); | 656 | put_mtd_device(mtd); |
@@ -651,6 +672,11 @@ static void detach_mtd_dev(struct ubi_device *ubi) | |||
651 | ubi_wl_close(ubi); | 672 | ubi_wl_close(ubi); |
652 | vfree(ubi->vtbl); | 673 | vfree(ubi->vtbl); |
653 | put_mtd_device(ubi->mtd); | 674 | put_mtd_device(ubi->mtd); |
675 | vfree(ubi->peb_buf1); | ||
676 | vfree(ubi->peb_buf2); | ||
677 | #ifdef CONFIG_MTD_UBI_DEBUG | ||
678 | vfree(ubi->dbg_peb_buf); | ||
679 | #endif | ||
654 | kfree(ubi_devices[ubi_num]); | 680 | kfree(ubi_devices[ubi_num]); |
655 | ubi_devices[ubi_num] = NULL; | 681 | ubi_devices[ubi_num] = NULL; |
656 | ubi_devices_cnt -= 1; | 682 | ubi_devices_cnt -= 1; |
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 89193104c6c8..81bb6a33b555 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -495,16 +495,18 @@ static int recover_peb(struct ubi_device *ubi, int pnum, int vol_id, int lnum, | |||
495 | int err, idx = vol_id2idx(ubi, vol_id), new_pnum, data_size, tries = 0; | 495 | int err, idx = vol_id2idx(ubi, vol_id), new_pnum, data_size, tries = 0; |
496 | struct ubi_volume *vol = ubi->volumes[idx]; | 496 | struct ubi_volume *vol = ubi->volumes[idx]; |
497 | struct ubi_vid_hdr *vid_hdr; | 497 | struct ubi_vid_hdr *vid_hdr; |
498 | unsigned char *new_buf; | ||
499 | 498 | ||
500 | vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); | 499 | vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); |
501 | if (!vid_hdr) { | 500 | if (!vid_hdr) { |
502 | return -ENOMEM; | 501 | return -ENOMEM; |
503 | } | 502 | } |
504 | 503 | ||
504 | mutex_lock(&ubi->buf_mutex); | ||
505 | |||
505 | retry: | 506 | retry: |
506 | new_pnum = ubi_wl_get_peb(ubi, UBI_UNKNOWN); | 507 | new_pnum = ubi_wl_get_peb(ubi, UBI_UNKNOWN); |
507 | if (new_pnum < 0) { | 508 | if (new_pnum < 0) { |
509 | mutex_unlock(&ubi->buf_mutex); | ||
508 | ubi_free_vid_hdr(ubi, vid_hdr); | 510 | ubi_free_vid_hdr(ubi, vid_hdr); |
509 | return new_pnum; | 511 | return new_pnum; |
510 | } | 512 | } |
@@ -524,31 +526,22 @@ retry: | |||
524 | goto write_error; | 526 | goto write_error; |
525 | 527 | ||
526 | data_size = offset + len; | 528 | data_size = offset + len; |
527 | new_buf = vmalloc(data_size); | 529 | memset(ubi->peb_buf1 + offset, 0xFF, len); |
528 | if (!new_buf) { | ||
529 | err = -ENOMEM; | ||
530 | goto out_put; | ||
531 | } | ||
532 | memset(new_buf + offset, 0xFF, len); | ||
533 | 530 | ||
534 | /* Read everything before the area where the write failure happened */ | 531 | /* Read everything before the area where the write failure happened */ |
535 | if (offset > 0) { | 532 | if (offset > 0) { |
536 | err = ubi_io_read_data(ubi, new_buf, pnum, 0, offset); | 533 | err = ubi_io_read_data(ubi, ubi->peb_buf1, pnum, 0, offset); |
537 | if (err && err != UBI_IO_BITFLIPS) { | 534 | if (err && err != UBI_IO_BITFLIPS) |
538 | vfree(new_buf); | ||
539 | goto out_put; | 535 | goto out_put; |
540 | } | ||
541 | } | 536 | } |
542 | 537 | ||
543 | memcpy(new_buf + offset, buf, len); | 538 | memcpy(ubi->peb_buf1 + offset, buf, len); |
544 | 539 | ||
545 | err = ubi_io_write_data(ubi, new_buf, new_pnum, 0, data_size); | 540 | err = ubi_io_write_data(ubi, ubi->peb_buf1, new_pnum, 0, data_size); |
546 | if (err) { | 541 | if (err) |
547 | vfree(new_buf); | ||
548 | goto write_error; | 542 | goto write_error; |
549 | } | ||
550 | 543 | ||
551 | vfree(new_buf); | 544 | mutex_unlock(&ubi->buf_mutex); |
552 | ubi_free_vid_hdr(ubi, vid_hdr); | 545 | ubi_free_vid_hdr(ubi, vid_hdr); |
553 | 546 | ||
554 | vol->eba_tbl[lnum] = new_pnum; | 547 | vol->eba_tbl[lnum] = new_pnum; |
@@ -558,6 +551,7 @@ retry: | |||
558 | return 0; | 551 | return 0; |
559 | 552 | ||
560 | out_put: | 553 | out_put: |
554 | mutex_unlock(&ubi->buf_mutex); | ||
561 | ubi_wl_put_peb(ubi, new_pnum, 1); | 555 | ubi_wl_put_peb(ubi, new_pnum, 1); |
562 | ubi_free_vid_hdr(ubi, vid_hdr); | 556 | ubi_free_vid_hdr(ubi, vid_hdr); |
563 | return err; | 557 | return err; |
@@ -570,6 +564,7 @@ write_error: | |||
570 | ubi_warn("failed to write to PEB %d", new_pnum); | 564 | ubi_warn("failed to write to PEB %d", new_pnum); |
571 | ubi_wl_put_peb(ubi, new_pnum, 1); | 565 | ubi_wl_put_peb(ubi, new_pnum, 1); |
572 | if (++tries > UBI_IO_RETRIES) { | 566 | if (++tries > UBI_IO_RETRIES) { |
567 | mutex_unlock(&ubi->buf_mutex); | ||
573 | ubi_free_vid_hdr(ubi, vid_hdr); | 568 | ubi_free_vid_hdr(ubi, vid_hdr); |
574 | return err; | 569 | return err; |
575 | } | 570 | } |
@@ -965,7 +960,6 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
965 | int err, vol_id, lnum, data_size, aldata_size, pnum, idx; | 960 | int err, vol_id, lnum, data_size, aldata_size, pnum, idx; |
966 | struct ubi_volume *vol; | 961 | struct ubi_volume *vol; |
967 | uint32_t crc; | 962 | uint32_t crc; |
968 | void *buf, *buf1 = NULL; | ||
969 | 963 | ||
970 | vol_id = be32_to_cpu(vid_hdr->vol_id); | 964 | vol_id = be32_to_cpu(vid_hdr->vol_id); |
971 | lnum = be32_to_cpu(vid_hdr->lnum); | 965 | lnum = be32_to_cpu(vid_hdr->lnum); |
@@ -979,19 +973,15 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
979 | data_size = aldata_size = | 973 | data_size = aldata_size = |
980 | ubi->leb_size - be32_to_cpu(vid_hdr->data_pad); | 974 | ubi->leb_size - be32_to_cpu(vid_hdr->data_pad); |
981 | 975 | ||
982 | buf = vmalloc(aldata_size); | ||
983 | if (!buf) | ||
984 | return -ENOMEM; | ||
985 | |||
986 | /* | 976 | /* |
987 | * We do not want anybody to write to this logical eraseblock while we | 977 | * We do not want anybody to write to this logical eraseblock while we |
988 | * are moving it, so we lock it. | 978 | * are moving it, so we lock it. |
989 | */ | 979 | */ |
990 | err = leb_write_lock(ubi, vol_id, lnum); | 980 | err = leb_write_lock(ubi, vol_id, lnum); |
991 | if (err) { | 981 | if (err) |
992 | vfree(buf); | ||
993 | return err; | 982 | return err; |
994 | } | 983 | |
984 | mutex_lock(&ubi->buf_mutex); | ||
995 | 985 | ||
996 | /* | 986 | /* |
997 | * But the logical eraseblock might have been put by this time. | 987 | * But the logical eraseblock might have been put by this time. |
@@ -1023,7 +1013,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
1023 | /* OK, now the LEB is locked and we can safely start moving it */ | 1013 | /* OK, now the LEB is locked and we can safely start moving it */ |
1024 | 1014 | ||
1025 | dbg_eba("read %d bytes of data", aldata_size); | 1015 | dbg_eba("read %d bytes of data", aldata_size); |
1026 | err = ubi_io_read_data(ubi, buf, from, 0, aldata_size); | 1016 | err = ubi_io_read_data(ubi, ubi->peb_buf1, from, 0, aldata_size); |
1027 | if (err && err != UBI_IO_BITFLIPS) { | 1017 | if (err && err != UBI_IO_BITFLIPS) { |
1028 | ubi_warn("error %d while reading data from PEB %d", | 1018 | ubi_warn("error %d while reading data from PEB %d", |
1029 | err, from); | 1019 | err, from); |
@@ -1042,10 +1032,10 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
1042 | */ | 1032 | */ |
1043 | if (vid_hdr->vol_type == UBI_VID_DYNAMIC) | 1033 | if (vid_hdr->vol_type == UBI_VID_DYNAMIC) |
1044 | aldata_size = data_size = | 1034 | aldata_size = data_size = |
1045 | ubi_calc_data_len(ubi, buf, data_size); | 1035 | ubi_calc_data_len(ubi, ubi->peb_buf1, data_size); |
1046 | 1036 | ||
1047 | cond_resched(); | 1037 | cond_resched(); |
1048 | crc = crc32(UBI_CRC32_INIT, buf, data_size); | 1038 | crc = crc32(UBI_CRC32_INIT, ubi->peb_buf1, data_size); |
1049 | cond_resched(); | 1039 | cond_resched(); |
1050 | 1040 | ||
1051 | /* | 1041 | /* |
@@ -1076,23 +1066,18 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
1076 | } | 1066 | } |
1077 | 1067 | ||
1078 | if (data_size > 0) { | 1068 | if (data_size > 0) { |
1079 | err = ubi_io_write_data(ubi, buf, to, 0, aldata_size); | 1069 | err = ubi_io_write_data(ubi, ubi->peb_buf1, to, 0, aldata_size); |
1080 | if (err) | 1070 | if (err) |
1081 | goto out_unlock; | 1071 | goto out_unlock; |
1082 | 1072 | ||
1073 | cond_resched(); | ||
1074 | |||
1083 | /* | 1075 | /* |
1084 | * We've written the data and are going to read it back to make | 1076 | * We've written the data and are going to read it back to make |
1085 | * sure it was written correctly. | 1077 | * sure it was written correctly. |
1086 | */ | 1078 | */ |
1087 | buf1 = vmalloc(aldata_size); | ||
1088 | if (!buf1) { | ||
1089 | err = -ENOMEM; | ||
1090 | goto out_unlock; | ||
1091 | } | ||
1092 | 1079 | ||
1093 | cond_resched(); | 1080 | err = ubi_io_read_data(ubi, ubi->peb_buf2, to, 0, aldata_size); |
1094 | |||
1095 | err = ubi_io_read_data(ubi, buf1, to, 0, aldata_size); | ||
1096 | if (err) { | 1081 | if (err) { |
1097 | if (err != UBI_IO_BITFLIPS) | 1082 | if (err != UBI_IO_BITFLIPS) |
1098 | ubi_warn("cannot read data back from PEB %d", | 1083 | ubi_warn("cannot read data back from PEB %d", |
@@ -1102,7 +1087,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
1102 | 1087 | ||
1103 | cond_resched(); | 1088 | cond_resched(); |
1104 | 1089 | ||
1105 | if (memcmp(buf, buf1, aldata_size)) { | 1090 | if (memcmp(ubi->peb_buf1, ubi->peb_buf2, aldata_size)) { |
1106 | ubi_warn("read data back from PEB %d - it is different", | 1091 | ubi_warn("read data back from PEB %d - it is different", |
1107 | to); | 1092 | to); |
1108 | goto out_unlock; | 1093 | goto out_unlock; |
@@ -1112,16 +1097,9 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, | |||
1112 | ubi_assert(vol->eba_tbl[lnum] == from); | 1097 | ubi_assert(vol->eba_tbl[lnum] == from); |
1113 | vol->eba_tbl[lnum] = to; | 1098 | vol->eba_tbl[lnum] = to; |
1114 | 1099 | ||
1115 | leb_write_unlock(ubi, vol_id, lnum); | ||
1116 | vfree(buf); | ||
1117 | vfree(buf1); | ||
1118 | |||
1119 | return 0; | ||
1120 | |||
1121 | out_unlock: | 1100 | out_unlock: |
1101 | mutex_unlock(&ubi->buf_mutex); | ||
1122 | leb_write_unlock(ubi, vol_id, lnum); | 1102 | leb_write_unlock(ubi, vol_id, lnum); |
1123 | vfree(buf); | ||
1124 | vfree(buf1); | ||
1125 | return err; | 1103 | return err; |
1126 | } | 1104 | } |
1127 | 1105 | ||
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index ba5bc4a5379e..52476d884c48 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -98,8 +98,8 @@ static int paranoid_check_ec_hdr(const struct ubi_device *ubi, int pnum, | |||
98 | static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); | 98 | static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); |
99 | static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum, | 99 | static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum, |
100 | const struct ubi_vid_hdr *vid_hdr); | 100 | const struct ubi_vid_hdr *vid_hdr); |
101 | static int paranoid_check_all_ff(const struct ubi_device *ubi, int pnum, | 101 | static int paranoid_check_all_ff(struct ubi_device *ubi, int pnum, int offset, |
102 | int offset, int len); | 102 | int len); |
103 | #else | 103 | #else |
104 | #define paranoid_check_not_bad(ubi, pnum) 0 | 104 | #define paranoid_check_not_bad(ubi, pnum) 0 |
105 | #define paranoid_check_peb_ec_hdr(ubi, pnum) 0 | 105 | #define paranoid_check_peb_ec_hdr(ubi, pnum) 0 |
@@ -202,8 +202,8 @@ retry: | |||
202 | * Note, in case of an error, it is possible that something was still written | 202 | * Note, in case of an error, it is possible that something was still written |
203 | * to the flash media, but may be some garbage. | 203 | * to the flash media, but may be some garbage. |
204 | */ | 204 | */ |
205 | int ubi_io_write(const struct ubi_device *ubi, const void *buf, int pnum, | 205 | int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, |
206 | int offset, int len) | 206 | int len) |
207 | { | 207 | { |
208 | int err; | 208 | int err; |
209 | size_t written; | 209 | size_t written; |
@@ -285,7 +285,7 @@ static void erase_callback(struct erase_info *ei) | |||
285 | * zero in case of success and a negative error code in case of failure. If | 285 | * zero in case of success and a negative error code in case of failure. If |
286 | * %-EIO is returned, the physical eraseblock most probably went bad. | 286 | * %-EIO is returned, the physical eraseblock most probably went bad. |
287 | */ | 287 | */ |
288 | static int do_sync_erase(const struct ubi_device *ubi, int pnum) | 288 | static int do_sync_erase(struct ubi_device *ubi, int pnum) |
289 | { | 289 | { |
290 | int err, retries = 0; | 290 | int err, retries = 0; |
291 | struct erase_info ei; | 291 | struct erase_info ei; |
@@ -377,29 +377,25 @@ static uint8_t patterns[] = {0xa5, 0x5a, 0x0}; | |||
377 | * test, a positive number of erase operations done if the test was | 377 | * test, a positive number of erase operations done if the test was |
378 | * successfully passed, and other negative error codes in case of other errors. | 378 | * successfully passed, and other negative error codes in case of other errors. |
379 | */ | 379 | */ |
380 | static int torture_peb(const struct ubi_device *ubi, int pnum) | 380 | static int torture_peb(struct ubi_device *ubi, int pnum) |
381 | { | 381 | { |
382 | void *buf; | ||
383 | int err, i, patt_count; | 382 | int err, i, patt_count; |
384 | 383 | ||
385 | buf = vmalloc(ubi->peb_size); | ||
386 | if (!buf) | ||
387 | return -ENOMEM; | ||
388 | |||
389 | patt_count = ARRAY_SIZE(patterns); | 384 | patt_count = ARRAY_SIZE(patterns); |
390 | ubi_assert(patt_count > 0); | 385 | ubi_assert(patt_count > 0); |
391 | 386 | ||
387 | mutex_lock(&ubi->buf_mutex); | ||
392 | for (i = 0; i < patt_count; i++) { | 388 | for (i = 0; i < patt_count; i++) { |
393 | err = do_sync_erase(ubi, pnum); | 389 | err = do_sync_erase(ubi, pnum); |
394 | if (err) | 390 | if (err) |
395 | goto out; | 391 | goto out; |
396 | 392 | ||
397 | /* Make sure the PEB contains only 0xFF bytes */ | 393 | /* Make sure the PEB contains only 0xFF bytes */ |
398 | err = ubi_io_read(ubi, buf, pnum, 0, ubi->peb_size); | 394 | err = ubi_io_read(ubi, ubi->peb_buf1, pnum, 0, ubi->peb_size); |
399 | if (err) | 395 | if (err) |
400 | goto out; | 396 | goto out; |
401 | 397 | ||
402 | err = check_pattern(buf, 0xFF, ubi->peb_size); | 398 | err = check_pattern(ubi->peb_buf1, 0xFF, ubi->peb_size); |
403 | if (err == 0) { | 399 | if (err == 0) { |
404 | ubi_err("erased PEB %d, but a non-0xFF byte found", | 400 | ubi_err("erased PEB %d, but a non-0xFF byte found", |
405 | pnum); | 401 | pnum); |
@@ -408,17 +404,17 @@ static int torture_peb(const struct ubi_device *ubi, int pnum) | |||
408 | } | 404 | } |
409 | 405 | ||
410 | /* Write a pattern and check it */ | 406 | /* Write a pattern and check it */ |
411 | memset(buf, patterns[i], ubi->peb_size); | 407 | memset(ubi->peb_buf1, patterns[i], ubi->peb_size); |
412 | err = ubi_io_write(ubi, buf, pnum, 0, ubi->peb_size); | 408 | err = ubi_io_write(ubi, ubi->peb_buf1, pnum, 0, ubi->peb_size); |
413 | if (err) | 409 | if (err) |
414 | goto out; | 410 | goto out; |
415 | 411 | ||
416 | memset(buf, ~patterns[i], ubi->peb_size); | 412 | memset(ubi->peb_buf1, ~patterns[i], ubi->peb_size); |
417 | err = ubi_io_read(ubi, buf, pnum, 0, ubi->peb_size); | 413 | err = ubi_io_read(ubi, ubi->peb_buf1, pnum, 0, ubi->peb_size); |
418 | if (err) | 414 | if (err) |
419 | goto out; | 415 | goto out; |
420 | 416 | ||
421 | err = check_pattern(buf, patterns[i], ubi->peb_size); | 417 | err = check_pattern(ubi->peb_buf1, patterns[i], ubi->peb_size); |
422 | if (err == 0) { | 418 | if (err == 0) { |
423 | ubi_err("pattern %x checking failed for PEB %d", | 419 | ubi_err("pattern %x checking failed for PEB %d", |
424 | patterns[i], pnum); | 420 | patterns[i], pnum); |
@@ -430,6 +426,7 @@ static int torture_peb(const struct ubi_device *ubi, int pnum) | |||
430 | err = patt_count; | 426 | err = patt_count; |
431 | 427 | ||
432 | out: | 428 | out: |
429 | mutex_unlock(&ubi->buf_mutex); | ||
433 | if (err == UBI_IO_BITFLIPS || err == -EBADMSG) { | 430 | if (err == UBI_IO_BITFLIPS || err == -EBADMSG) { |
434 | /* | 431 | /* |
435 | * If a bit-flip or data integrity error was detected, the test | 432 | * If a bit-flip or data integrity error was detected, the test |
@@ -440,7 +437,6 @@ out: | |||
440 | pnum); | 437 | pnum); |
441 | err = -EIO; | 438 | err = -EIO; |
442 | } | 439 | } |
443 | vfree(buf); | ||
444 | return err; | 440 | return err; |
445 | } | 441 | } |
446 | 442 | ||
@@ -460,7 +456,7 @@ out: | |||
460 | * codes in case of other errors. Note, %-EIO means that the physical | 456 | * codes in case of other errors. Note, %-EIO means that the physical |
461 | * eraseblock is bad. | 457 | * eraseblock is bad. |
462 | */ | 458 | */ |
463 | int ubi_io_sync_erase(const struct ubi_device *ubi, int pnum, int torture) | 459 | int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture) |
464 | { | 460 | { |
465 | int err, ret = 0; | 461 | int err, ret = 0; |
466 | 462 | ||
@@ -617,7 +613,7 @@ bad: | |||
617 | * o %UBI_IO_PEB_EMPTY if the physical eraseblock is empty; | 613 | * o %UBI_IO_PEB_EMPTY if the physical eraseblock is empty; |
618 | * o a negative error code in case of failure. | 614 | * o a negative error code in case of failure. |
619 | */ | 615 | */ |
620 | int ubi_io_read_ec_hdr(const struct ubi_device *ubi, int pnum, | 616 | int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, |
621 | struct ubi_ec_hdr *ec_hdr, int verbose) | 617 | struct ubi_ec_hdr *ec_hdr, int verbose) |
622 | { | 618 | { |
623 | int err, read_err = 0; | 619 | int err, read_err = 0; |
@@ -723,7 +719,7 @@ int ubi_io_read_ec_hdr(const struct ubi_device *ubi, int pnum, | |||
723 | * case of failure. If %-EIO is returned, the physical eraseblock most probably | 719 | * case of failure. If %-EIO is returned, the physical eraseblock most probably |
724 | * went bad. | 720 | * went bad. |
725 | */ | 721 | */ |
726 | int ubi_io_write_ec_hdr(const struct ubi_device *ubi, int pnum, | 722 | int ubi_io_write_ec_hdr(struct ubi_device *ubi, int pnum, |
727 | struct ubi_ec_hdr *ec_hdr) | 723 | struct ubi_ec_hdr *ec_hdr) |
728 | { | 724 | { |
729 | int err; | 725 | int err; |
@@ -889,7 +885,7 @@ bad: | |||
889 | * header there); | 885 | * header there); |
890 | * o a negative error code in case of failure. | 886 | * o a negative error code in case of failure. |
891 | */ | 887 | */ |
892 | int ubi_io_read_vid_hdr(const struct ubi_device *ubi, int pnum, | 888 | int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, |
893 | struct ubi_vid_hdr *vid_hdr, int verbose) | 889 | struct ubi_vid_hdr *vid_hdr, int verbose) |
894 | { | 890 | { |
895 | int err, read_err = 0; | 891 | int err, read_err = 0; |
@@ -996,7 +992,7 @@ int ubi_io_read_vid_hdr(const struct ubi_device *ubi, int pnum, | |||
996 | * case of failure. If %-EIO is returned, the physical eraseblock probably went | 992 | * case of failure. If %-EIO is returned, the physical eraseblock probably went |
997 | * bad. | 993 | * bad. |
998 | */ | 994 | */ |
999 | int ubi_io_write_vid_hdr(const struct ubi_device *ubi, int pnum, | 995 | int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum, |
1000 | struct ubi_vid_hdr *vid_hdr) | 996 | struct ubi_vid_hdr *vid_hdr) |
1001 | { | 997 | { |
1002 | int err; | 998 | int err; |
@@ -1219,44 +1215,40 @@ exit: | |||
1219 | * @offset of the physical eraseblock @pnum, %1 if not, and a negative error | 1215 | * @offset of the physical eraseblock @pnum, %1 if not, and a negative error |
1220 | * code if an error occurred. | 1216 | * code if an error occurred. |
1221 | */ | 1217 | */ |
1222 | static int paranoid_check_all_ff(const struct ubi_device *ubi, int pnum, | 1218 | static int paranoid_check_all_ff(struct ubi_device *ubi, int pnum, int offset, |
1223 | int offset, int len) | 1219 | int len) |
1224 | { | 1220 | { |
1225 | size_t read; | 1221 | size_t read; |
1226 | int err; | 1222 | int err; |
1227 | void *buf; | ||
1228 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; | 1223 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; |
1229 | 1224 | ||
1230 | buf = vmalloc(len); | 1225 | mutex_lock(&ubi->dbg_buf_mutex); |
1231 | if (!buf) | 1226 | err = ubi->mtd->read(ubi->mtd, addr, len, &read, ubi->dbg_peb_buf); |
1232 | return -ENOMEM; | ||
1233 | memset(buf, 0, len); | ||
1234 | |||
1235 | err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); | ||
1236 | if (err && err != -EUCLEAN) { | 1227 | if (err && err != -EUCLEAN) { |
1237 | ubi_err("error %d while reading %d bytes from PEB %d:%d, " | 1228 | ubi_err("error %d while reading %d bytes from PEB %d:%d, " |
1238 | "read %zd bytes", err, len, pnum, offset, read); | 1229 | "read %zd bytes", err, len, pnum, offset, read); |
1239 | goto error; | 1230 | goto error; |
1240 | } | 1231 | } |
1241 | 1232 | ||
1242 | err = check_pattern(buf, 0xFF, len); | 1233 | err = check_pattern(ubi->dbg_peb_buf, 0xFF, len); |
1243 | if (err == 0) { | 1234 | if (err == 0) { |
1244 | ubi_err("flash region at PEB %d:%d, length %d does not " | 1235 | ubi_err("flash region at PEB %d:%d, length %d does not " |
1245 | "contain all 0xFF bytes", pnum, offset, len); | 1236 | "contain all 0xFF bytes", pnum, offset, len); |
1246 | goto fail; | 1237 | goto fail; |
1247 | } | 1238 | } |
1239 | mutex_unlock(&ubi->dbg_buf_mutex); | ||
1248 | 1240 | ||
1249 | vfree(buf); | ||
1250 | return 0; | 1241 | return 0; |
1251 | 1242 | ||
1252 | fail: | 1243 | fail: |
1253 | ubi_err("paranoid check failed for PEB %d", pnum); | 1244 | ubi_err("paranoid check failed for PEB %d", pnum); |
1254 | dbg_msg("hex dump of the %d-%d region", offset, offset + len); | 1245 | dbg_msg("hex dump of the %d-%d region", offset, offset + len); |
1255 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); | 1246 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, |
1247 | ubi->dbg_peb_buf, len, 1); | ||
1256 | err = 1; | 1248 | err = 1; |
1257 | error: | 1249 | error: |
1258 | ubi_dbg_dump_stack(); | 1250 | ubi_dbg_dump_stack(); |
1259 | vfree(buf); | 1251 | mutex_unlock(&ubi->dbg_buf_mutex); |
1260 | return err; | 1252 | return err; |
1261 | } | 1253 | } |
1262 | 1254 | ||
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 1c1401d6958b..44d87e8158c6 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -45,8 +45,7 @@ | |||
45 | #include "ubi.h" | 45 | #include "ubi.h" |
46 | 46 | ||
47 | #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID | 47 | #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID |
48 | static int paranoid_check_si(const struct ubi_device *ubi, | 48 | static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si); |
49 | struct ubi_scan_info *si); | ||
50 | #else | 49 | #else |
51 | #define paranoid_check_si(ubi, si) 0 | 50 | #define paranoid_check_si(ubi, si) 0 |
52 | #endif | 51 | #endif |
@@ -259,9 +258,8 @@ static struct ubi_scan_volume *add_volume(struct ubi_scan_info *si, int vol_id, | |||
259 | * o bit 2 is cleared: the older LEB is not corrupted; | 258 | * o bit 2 is cleared: the older LEB is not corrupted; |
260 | * o bit 2 is set: the older LEB is corrupted. | 259 | * o bit 2 is set: the older LEB is corrupted. |
261 | */ | 260 | */ |
262 | static int compare_lebs(const struct ubi_device *ubi, | 261 | static int compare_lebs(struct ubi_device *ubi, const struct ubi_scan_leb *seb, |
263 | const struct ubi_scan_leb *seb, int pnum, | 262 | int pnum, const struct ubi_vid_hdr *vid_hdr) |
264 | const struct ubi_vid_hdr *vid_hdr) | ||
265 | { | 263 | { |
266 | void *buf; | 264 | void *buf; |
267 | int len, err, second_is_newer, bitflips = 0, corrupted = 0; | 265 | int len, err, second_is_newer, bitflips = 0, corrupted = 0; |
@@ -413,7 +411,7 @@ out_free_vidh: | |||
413 | * to be picked, while the older one has to be dropped. This function returns | 411 | * to be picked, while the older one has to be dropped. This function returns |
414 | * zero in case of success and a negative error code in case of failure. | 412 | * zero in case of success and a negative error code in case of failure. |
415 | */ | 413 | */ |
416 | int ubi_scan_add_used(const struct ubi_device *ubi, struct ubi_scan_info *si, | 414 | int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si, |
417 | int pnum, int ec, const struct ubi_vid_hdr *vid_hdr, | 415 | int pnum, int ec, const struct ubi_vid_hdr *vid_hdr, |
418 | int bitflips) | 416 | int bitflips) |
419 | { | 417 | { |
@@ -667,8 +665,8 @@ void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv) | |||
667 | * function returns zero in case of success and a negative error code in case | 665 | * function returns zero in case of success and a negative error code in case |
668 | * of failure. | 666 | * of failure. |
669 | */ | 667 | */ |
670 | int ubi_scan_erase_peb(const struct ubi_device *ubi, | 668 | int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si, |
671 | const struct ubi_scan_info *si, int pnum, int ec) | 669 | int pnum, int ec) |
672 | { | 670 | { |
673 | int err; | 671 | int err; |
674 | struct ubi_ec_hdr *ec_hdr; | 672 | struct ubi_ec_hdr *ec_hdr; |
@@ -712,7 +710,7 @@ out_free: | |||
712 | * This function returns scanning physical eraseblock information in case of | 710 | * This function returns scanning physical eraseblock information in case of |
713 | * success and an error code in case of failure. | 711 | * success and an error code in case of failure. |
714 | */ | 712 | */ |
715 | struct ubi_scan_leb *ubi_scan_get_free_peb(const struct ubi_device *ubi, | 713 | struct ubi_scan_leb *ubi_scan_get_free_peb(struct ubi_device *ubi, |
716 | struct ubi_scan_info *si) | 714 | struct ubi_scan_info *si) |
717 | { | 715 | { |
718 | int err = 0, i; | 716 | int err = 0, i; |
@@ -1110,8 +1108,7 @@ void ubi_scan_destroy_si(struct ubi_scan_info *si) | |||
1110 | * This function returns zero if the scanning information is all right, %1 if | 1108 | * This function returns zero if the scanning information is all right, %1 if |
1111 | * not and a negative error code if an error occurred. | 1109 | * not and a negative error code if an error occurred. |
1112 | */ | 1110 | */ |
1113 | static int paranoid_check_si(const struct ubi_device *ubi, | 1111 | static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si) |
1114 | struct ubi_scan_info *si) | ||
1115 | { | 1112 | { |
1116 | int pnum, err, vols_found = 0; | 1113 | int pnum, err, vols_found = 0; |
1117 | struct rb_node *rb1, *rb2; | 1114 | struct rb_node *rb1, *rb2; |
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h index 140e82e26534..46d444af471a 100644 --- a/drivers/mtd/ubi/scan.h +++ b/drivers/mtd/ubi/scan.h | |||
@@ -147,7 +147,7 @@ static inline void ubi_scan_move_to_list(struct ubi_scan_volume *sv, | |||
147 | list_add_tail(&seb->u.list, list); | 147 | list_add_tail(&seb->u.list, list); |
148 | } | 148 | } |
149 | 149 | ||
150 | int ubi_scan_add_used(const struct ubi_device *ubi, struct ubi_scan_info *si, | 150 | int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si, |
151 | int pnum, int ec, const struct ubi_vid_hdr *vid_hdr, | 151 | int pnum, int ec, const struct ubi_vid_hdr *vid_hdr, |
152 | int bitflips); | 152 | int bitflips); |
153 | struct ubi_scan_volume *ubi_scan_find_sv(const struct ubi_scan_info *si, | 153 | struct ubi_scan_volume *ubi_scan_find_sv(const struct ubi_scan_info *si, |
@@ -155,10 +155,10 @@ struct ubi_scan_volume *ubi_scan_find_sv(const struct ubi_scan_info *si, | |||
155 | struct ubi_scan_leb *ubi_scan_find_seb(const struct ubi_scan_volume *sv, | 155 | struct ubi_scan_leb *ubi_scan_find_seb(const struct ubi_scan_volume *sv, |
156 | int lnum); | 156 | int lnum); |
157 | void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv); | 157 | void ubi_scan_rm_volume(struct ubi_scan_info *si, struct ubi_scan_volume *sv); |
158 | struct ubi_scan_leb *ubi_scan_get_free_peb(const struct ubi_device *ubi, | 158 | struct ubi_scan_leb *ubi_scan_get_free_peb(struct ubi_device *ubi, |
159 | struct ubi_scan_info *si); | 159 | struct ubi_scan_info *si); |
160 | int ubi_scan_erase_peb(const struct ubi_device *ubi, | 160 | int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si, |
161 | const struct ubi_scan_info *si, int pnum, int ec); | 161 | int pnum, int ec); |
162 | struct ubi_scan_info *ubi_scan(struct ubi_device *ubi); | 162 | struct ubi_scan_info *ubi_scan(struct ubi_device *ubi); |
163 | void ubi_scan_destroy_si(struct ubi_scan_info *si); | 163 | void ubi_scan_destroy_si(struct ubi_scan_info *si); |
164 | 164 | ||
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 329663188772..cc010111264f 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -274,6 +274,12 @@ struct ubi_wl_entry; | |||
274 | * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or | 274 | * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or |
275 | * not | 275 | * not |
276 | * @mtd: MTD device descriptor | 276 | * @mtd: MTD device descriptor |
277 | * | ||
278 | * @peb_buf1: a buffer of PEB size used for different purposes | ||
279 | * @peb_buf2: another buffer of PEB size used for different purposes | ||
280 | * @buf_mutex: proptects @peb_buf1 and @peb_buf2 | ||
281 | * @dbg_peb_buf: buffer of PEB size used for debugging | ||
282 | * @dbg_buf_mutex: proptects @dbg_peb_buf | ||
277 | */ | 283 | */ |
278 | struct ubi_device { | 284 | struct ubi_device { |
279 | struct cdev cdev; | 285 | struct cdev cdev; |
@@ -343,6 +349,14 @@ struct ubi_device { | |||
343 | int vid_hdr_shift; | 349 | int vid_hdr_shift; |
344 | int bad_allowed; | 350 | int bad_allowed; |
345 | struct mtd_info *mtd; | 351 | struct mtd_info *mtd; |
352 | |||
353 | void *peb_buf1; | ||
354 | void *peb_buf2; | ||
355 | struct mutex buf_mutex; | ||
356 | #ifdef CONFIG_MTD_UBI_DEBUG | ||
357 | void *dbg_peb_buf; | ||
358 | struct mutex dbg_buf_mutex; | ||
359 | #endif | ||
346 | }; | 360 | }; |
347 | 361 | ||
348 | extern struct file_operations ubi_cdev_operations; | 362 | extern struct file_operations ubi_cdev_operations; |
@@ -409,18 +423,18 @@ void ubi_wl_close(struct ubi_device *ubi); | |||
409 | /* io.c */ | 423 | /* io.c */ |
410 | int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, | 424 | int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, |
411 | int len); | 425 | int len); |
412 | int ubi_io_write(const struct ubi_device *ubi, const void *buf, int pnum, | 426 | int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, |
413 | int offset, int len); | 427 | int len); |
414 | int ubi_io_sync_erase(const struct ubi_device *ubi, int pnum, int torture); | 428 | int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture); |
415 | int ubi_io_is_bad(const struct ubi_device *ubi, int pnum); | 429 | int ubi_io_is_bad(const struct ubi_device *ubi, int pnum); |
416 | int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum); | 430 | int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum); |
417 | int ubi_io_read_ec_hdr(const struct ubi_device *ubi, int pnum, | 431 | int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, |
418 | struct ubi_ec_hdr *ec_hdr, int verbose); | 432 | struct ubi_ec_hdr *ec_hdr, int verbose); |
419 | int ubi_io_write_ec_hdr(const struct ubi_device *ubi, int pnum, | 433 | int ubi_io_write_ec_hdr(struct ubi_device *ubi, int pnum, |
420 | struct ubi_ec_hdr *ec_hdr); | 434 | struct ubi_ec_hdr *ec_hdr); |
421 | int ubi_io_read_vid_hdr(const struct ubi_device *ubi, int pnum, | 435 | int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, |
422 | struct ubi_vid_hdr *vid_hdr, int verbose); | 436 | struct ubi_vid_hdr *vid_hdr, int verbose); |
423 | int ubi_io_write_vid_hdr(const struct ubi_device *ubi, int pnum, | 437 | int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum, |
424 | struct ubi_vid_hdr *vid_hdr); | 438 | struct ubi_vid_hdr *vid_hdr); |
425 | 439 | ||
426 | /* | 440 | /* |
@@ -494,7 +508,7 @@ static inline int ubi_io_read_data(const struct ubi_device *ubi, void *buf, | |||
494 | * the beginning of the logical eraseblock, not to the beginning of the | 508 | * the beginning of the logical eraseblock, not to the beginning of the |
495 | * physical eraseblock. | 509 | * physical eraseblock. |
496 | */ | 510 | */ |
497 | static inline int ubi_io_write_data(const struct ubi_device *ubi, const void *buf, | 511 | static inline int ubi_io_write_data(struct ubi_device *ubi, const void *buf, |
498 | int pnum, int offset, int len) | 512 | int pnum, int offset, int len) |
499 | { | 513 | { |
500 | ubi_assert(offset >= 0); | 514 | ubi_assert(offset >= 0); |
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index b0a1e8426456..25b3bd61c7ec 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -254,7 +254,7 @@ bad: | |||
254 | * This function returns zero in case of success and a negative error code in | 254 | * This function returns zero in case of success and a negative error code in |
255 | * case of failure. | 255 | * case of failure. |
256 | */ | 256 | */ |
257 | static int create_vtbl(const struct ubi_device *ubi, struct ubi_scan_info *si, | 257 | static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si, |
258 | int copy, void *vtbl) | 258 | int copy, void *vtbl) |
259 | { | 259 | { |
260 | int err, tries = 0; | 260 | int err, tries = 0; |
@@ -339,7 +339,7 @@ out_free: | |||
339 | * not corrupted, and recovering from corruptions if needed. Returns volume | 339 | * not corrupted, and recovering from corruptions if needed. Returns volume |
340 | * table in case of success and a negative error code in case of failure. | 340 | * table in case of success and a negative error code in case of failure. |
341 | */ | 341 | */ |
342 | static struct ubi_vtbl_record *process_lvol(const struct ubi_device *ubi, | 342 | static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi, |
343 | struct ubi_scan_info *si, | 343 | struct ubi_scan_info *si, |
344 | struct ubi_scan_volume *sv) | 344 | struct ubi_scan_volume *sv) |
345 | { | 345 | { |
@@ -453,7 +453,7 @@ out_free: | |||
453 | * This function returns volume table contents in case of success and a | 453 | * This function returns volume table contents in case of success and a |
454 | * negative error code in case of failure. | 454 | * negative error code in case of failure. |
455 | */ | 455 | */ |
456 | static struct ubi_vtbl_record *create_empty_lvol(const struct ubi_device *ubi, | 456 | static struct ubi_vtbl_record *create_empty_lvol(struct ubi_device *ubi, |
457 | struct ubi_scan_info *si) | 457 | struct ubi_scan_info *si) |
458 | { | 458 | { |
459 | int i; | 459 | int i; |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 248ff9e477e7..6e5315bf5e1b 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -208,7 +208,7 @@ struct ubi_work { | |||
208 | }; | 208 | }; |
209 | 209 | ||
210 | #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID | 210 | #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID |
211 | static int paranoid_check_ec(const struct ubi_device *ubi, int pnum, int ec); | 211 | static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec); |
212 | static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, | 212 | static int paranoid_check_in_wl_tree(struct ubi_wl_entry *e, |
213 | struct rb_root *root); | 213 | struct rb_root *root); |
214 | #else | 214 | #else |
@@ -1625,7 +1625,7 @@ void ubi_wl_close(struct ubi_device *ubi) | |||
1625 | * is equivalent to @ec, %1 if not, and a negative error code if an error | 1625 | * is equivalent to @ec, %1 if not, and a negative error code if an error |
1626 | * occurred. | 1626 | * occurred. |
1627 | */ | 1627 | */ |
1628 | static int paranoid_check_ec(const struct ubi_device *ubi, int pnum, int ec) | 1628 | static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) |
1629 | { | 1629 | { |
1630 | int err; | 1630 | int err; |
1631 | long long read_ec; | 1631 | long long read_ec; |