if (!ubi->peb_buf1)
goto out_free;
- ubi->peb_buf2 = vmalloc(ubi->peb_size);
- if (!ubi->peb_buf2)
- goto out_free;
-
err = ubi_debugging_init_dev(ubi);
if (err)
goto out_free;
ubi_debugging_exit_dev(ubi);
out_free:
vfree(ubi->peb_buf1);
- vfree(ubi->peb_buf2);
if (ref)
put_device(&ubi->dev);
else
put_mtd_device(ubi->mtd);
ubi_debugging_exit_dev(ubi);
vfree(ubi->peb_buf1);
- vfree(ubi->peb_buf2);
ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num);
put_device(&ubi->dev);
return 0;
* 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 "
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;
* @mtd: MTD device descriptor
*
* @peb_buf1: a buffer of PEB size used for different purposes
- * @peb_buf2: another buffer of PEB size used for different purposes
- * @buf_mutex: protects @peb_buf1 and @peb_buf2
+ * @buf_mutex: protects @peb_buf1
* @ckvol_mutex: serializes static volume checking when opening
*
* @dbg: debugging information for this UBI device
struct mtd_info *mtd;
void *peb_buf1;
- void *peb_buf2;
struct mutex buf_mutex;
struct mutex ckvol_mutex;