summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/eba.c
diff options
context:
space:
mode:
authorJosselin Costanzi <josselin.costanzi@mobile-devices.fr>2012-02-22 16:37:05 +0100
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-03-09 09:39:31 +0200
commit43b043e78b876ce27034f167897b57fd2556ad29 (patch)
tree3397ed09387b4f74b4c2f23b1d04943baa0c7b11 /drivers/mtd/ubi/eba.c
parent7eb3aa65853e1b223bfc786b023b702018cb76c0 (diff)
UBI: reduce memory consumption
Remove the pre-allocated 'peb_buf2' buffer because we do not really need it. The only reason UBI has it is to check that the data were written correctly. But we do not have to have 2 buffers for this and waste RAM - we can just compare CRC checksums instead. This reduces UBI memory consumption. Artem bityutskiy: massaged the patch and commit message Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r--drivers/mtd/ubi/eba.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index cd26da8ad225..f548af3c98bb 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -1134,8 +1134,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
* We've written the data and are going to read it back to make
* sure it was written correctly.
*/
-
- err = ubi_io_read_data(ubi, ubi->peb_buf2, to, 0, aldata_size);
+ memset(ubi->peb_buf1, 0xFF, aldata_size);
+ err = ubi_io_read_data(ubi, ubi->peb_buf1, to, 0, aldata_size);
if (err) {
if (err != UBI_IO_BITFLIPS) {
ubi_warn("error %d while reading data back "
@@ -1149,7 +1149,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
cond_resched();
- if (memcmp(ubi->peb_buf1, ubi->peb_buf2, aldata_size)) {
+ if (crc != crc32(UBI_CRC32_INIT, ubi->peb_buf1, data_size)) {
ubi_warn("read data back from PEB %d and it is "
"different", to);
err = -EINVAL;