Commit 049333ce authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: comply with coding style

Join all the split printk lines in order to stop checkpatch complaining.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 193819cf
...@@ -378,8 +378,8 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, ...@@ -378,8 +378,8 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
if (err == UBI_IO_BITFLIPS) if (err == UBI_IO_BITFLIPS)
bitflips = 1; bitflips = 1;
else { else {
ubi_err("VID of PEB %d header is bad, but it " ubi_err("VID of PEB %d header is bad, but it was OK earlier, err %d",
"was OK earlier, err %d", pnum, err); pnum, err);
if (err > 0) if (err > 0)
err = -EIO; err = -EIO;
...@@ -790,9 +790,9 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr, ...@@ -790,9 +790,9 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
if (ubi_check_pattern(ubi->peb_buf, 0xFF, ubi->leb_size)) if (ubi_check_pattern(ubi->peb_buf, 0xFF, ubi->leb_size))
goto out_unlock; goto out_unlock;
ubi_err("PEB %d contains corrupted VID header, and the data does not " ubi_err("PEB %d contains corrupted VID header, and the data does not contain all 0xFF",
"contain all 0xFF, this may be a non-UBI PEB or a severe VID " pnum);
"header corruption which requires manual inspection", pnum); ubi_err("this may be a non-UBI PEB or a severe VID header corruption which requires manual inspection");
ubi_dump_vid_hdr(vid_hdr); ubi_dump_vid_hdr(vid_hdr);
dbg_msg("hexdump of PEB %d offset %d, length %d", dbg_msg("hexdump of PEB %d offset %d, length %d",
pnum, ubi->leb_start, ubi->leb_size); pnum, ubi->leb_start, ubi->leb_size);
...@@ -907,8 +907,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -907,8 +907,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
ubi->image_seq = image_seq; ubi->image_seq = image_seq;
if (ubi->image_seq && image_seq && if (ubi->image_seq && image_seq &&
ubi->image_seq != image_seq) { ubi->image_seq != image_seq) {
ubi_err("bad image sequence number %d in PEB %d, " ubi_err("bad image sequence number %d in PEB %d, expected %d",
"expected %d", image_seq, pnum, ubi->image_seq); image_seq, pnum, ubi->image_seq);
ubi_dump_ec_hdr(ech); ubi_dump_ec_hdr(ech);
return -EINVAL; return -EINVAL;
} }
...@@ -997,8 +997,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -997,8 +997,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
/* Unsupported internal volume */ /* Unsupported internal volume */
switch (vidh->compat) { switch (vidh->compat) {
case UBI_COMPAT_DELETE: case UBI_COMPAT_DELETE:
ubi_msg("\"delete\" compatible internal volume %d:%d" ubi_msg("\"delete\" compatible internal volume %d:%d found, will remove it",
" found, will remove it", vol_id, lnum); vol_id, lnum);
err = add_to_list(ai, pnum, vol_id, lnum, err = add_to_list(ai, pnum, vol_id, lnum,
ec, 1, &ai->erase); ec, 1, &ai->erase);
if (err) if (err)
...@@ -1006,15 +1006,14 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, ...@@ -1006,15 +1006,14 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
return 0; return 0;
case UBI_COMPAT_RO: case UBI_COMPAT_RO:
ubi_msg("read-only compatible internal volume %d:%d" ubi_msg("read-only compatible internal volume %d:%d found, switch to read-only mode",
" found, switch to read-only mode",
vol_id, lnum); vol_id, lnum);
ubi->ro_mode = 1; ubi->ro_mode = 1;
break; break;
case UBI_COMPAT_PRESERVE: case UBI_COMPAT_PRESERVE:
ubi_msg("\"preserve\" compatible internal volume %d:%d" ubi_msg("\"preserve\" compatible internal volume %d:%d found",
" found", vol_id, lnum); vol_id, lnum);
err = add_to_list(ai, pnum, vol_id, lnum, err = add_to_list(ai, pnum, vol_id, lnum,
ec, 0, &ai->alien); ec, 0, &ai->alien);
if (err) if (err)
...@@ -1112,8 +1111,7 @@ static int late_analysis(struct ubi_device *ubi, struct ubi_attach_info *ai) ...@@ -1112,8 +1111,7 @@ static int late_analysis(struct ubi_device *ubi, struct ubi_attach_info *ai)
get_random_bytes(&ubi->image_seq, get_random_bytes(&ubi->image_seq,
sizeof(ubi->image_seq)); sizeof(ubi->image_seq));
} else { } else {
ubi_err("MTD device is not UBI-formatted and possibly " ubi_err("MTD device is not UBI-formatted and possibly contains non-UBI data - refusing it");
"contains non-UBI data - refusing it");
return -EINVAL; return -EINVAL;
} }
......
...@@ -748,16 +748,15 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024) ...@@ -748,16 +748,15 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024)
* read-only mode. * read-only mode.
*/ */
if (ubi->vid_hdr_offset + UBI_VID_HDR_SIZE <= ubi->hdrs_min_io_size) { if (ubi->vid_hdr_offset + UBI_VID_HDR_SIZE <= ubi->hdrs_min_io_size) {
ubi_warn("EC and VID headers are in the same minimal I/O unit, " ubi_warn("EC and VID headers are in the same minimal I/O unit, switch to read-only mode");
"switch to read-only mode");
ubi->ro_mode = 1; ubi->ro_mode = 1;
} }
ubi->leb_size = ubi->peb_size - ubi->leb_start; ubi->leb_size = ubi->peb_size - ubi->leb_start;
if (!(ubi->mtd->flags & MTD_WRITEABLE)) { if (!(ubi->mtd->flags & MTD_WRITEABLE)) {
ubi_msg("MTD device %d is write-protected, attach in " ubi_msg("MTD device %d is write-protected, attach in read-only mode",
"read-only mode", ubi->mtd->index); ubi->mtd->index);
ubi->ro_mode = 1; ubi->ro_mode = 1;
} }
...@@ -892,8 +891,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, ...@@ -892,8 +891,8 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
* no sense to attach emulated MTD devices, so we prohibit this. * no sense to attach emulated MTD devices, so we prohibit this.
*/ */
if (mtd->type == MTD_UBIVOLUME) { if (mtd->type == MTD_UBIVOLUME) {
ubi_err("refuse attaching mtd%d - it is already emulated on " ubi_err("refuse attaching mtd%d - it is already emulated on top of UBI",
"top of UBI", mtd->index); mtd->index);
return -EINVAL; return -EINVAL;
} }
...@@ -1357,14 +1356,13 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp) ...@@ -1357,14 +1356,13 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
len = strnlen(val, MTD_PARAM_LEN_MAX); len = strnlen(val, MTD_PARAM_LEN_MAX);
if (len == MTD_PARAM_LEN_MAX) { if (len == MTD_PARAM_LEN_MAX) {
printk(KERN_ERR "UBI error: parameter \"%s\" is too long, " printk(KERN_ERR "UBI error: parameter \"%s\" is too long, max. is %d\n",
"max. is %d\n", val, MTD_PARAM_LEN_MAX); val, MTD_PARAM_LEN_MAX);
return -EINVAL; return -EINVAL;
} }
if (len == 0) { if (len == 0) {
printk(KERN_WARNING "UBI warning: empty 'mtd=' parameter - " printk(KERN_WARNING "UBI warning: empty 'mtd=' parameter - ignored\n");
"ignored\n");
return 0; return 0;
} }
...@@ -1396,8 +1394,8 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp) ...@@ -1396,8 +1394,8 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
int err = kstrtoint(tokens[2], 10, &p->max_beb_per1024); int err = kstrtoint(tokens[2], 10, &p->max_beb_per1024);
if (err) { if (err) {
printk(KERN_ERR "UBI error: bad value for " printk(KERN_ERR "UBI error: bad value for max_beb_per1024 parameter: %s",
"max_beb_per1024 parameter: %s", tokens[2]); tokens[2]);
return -EINVAL; return -EINVAL;
} }
} }
......
...@@ -140,9 +140,9 @@ static int vol_cdev_release(struct inode *inode, struct file *file) ...@@ -140,9 +140,9 @@ static int vol_cdev_release(struct inode *inode, struct file *file)
vol->updating = 0; vol->updating = 0;
vfree(vol->upd_buf); vfree(vol->upd_buf);
} else if (vol->changing_leb) { } else if (vol->changing_leb) {
dbg_gen("only %lld of %lld bytes received for atomic LEB change" dbg_gen("only %lld of %lld bytes received for atomic LEB change for volume %d:%d, cancel",
" for volume %d:%d, cancel", vol->upd_received, vol->upd_received, vol->upd_bytes, vol->ubi->ubi_num,
vol->upd_bytes, vol->ubi->ubi_num, vol->vol_id); vol->vol_id);
vol->changing_leb = 0; vol->changing_leb = 0;
vfree(vol->upd_buf); vfree(vol->upd_buf);
} }
...@@ -189,7 +189,8 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin) ...@@ -189,7 +189,8 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
return new_offset; return new_offset;
} }
static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end, int datasync) static int vol_cdev_fsync(struct file *file, loff_t start, loff_t end,
int datasync)
{ {
struct ubi_volume_desc *desc = file->private_data; struct ubi_volume_desc *desc = file->private_data;
struct ubi_device *ubi = desc->vol->ubi; struct ubi_device *ubi = desc->vol->ubi;
......
...@@ -43,8 +43,8 @@ void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len) ...@@ -43,8 +43,8 @@ void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len)
return; return;
err = mtd_read(ubi->mtd, addr, len, &read, buf); err = mtd_read(ubi->mtd, addr, len, &read, buf);
if (err && err != -EUCLEAN) { if (err && err != -EUCLEAN) {
ubi_err("error %d while reading %d bytes from PEB %d:%d, " ubi_err("error %d while reading %d bytes from PEB %d:%d, read %zd bytes",
"read %zd bytes", err, len, pnum, offset, read); err, len, pnum, offset, read);
goto out; goto out;
} }
......
...@@ -420,9 +420,8 @@ int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, ...@@ -420,9 +420,8 @@ int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
*/ */
if (err == UBI_IO_BAD_HDR_EBADMSG || if (err == UBI_IO_BAD_HDR_EBADMSG ||
err == UBI_IO_BAD_HDR) { err == UBI_IO_BAD_HDR) {
ubi_warn("corrupted VID header at PEB " ubi_warn("corrupted VID header at PEB %d, LEB %d:%d",
"%d, LEB %d:%d", pnum, vol_id, pnum, vol_id, lnum);
lnum);
err = -EBADMSG; err = -EBADMSG;
} else } else
ubi_ro_mode(ubi); ubi_ro_mode(ubi);
...@@ -660,9 +659,8 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, ...@@ -660,9 +659,8 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
if (len) { if (len) {
err = ubi_io_write_data(ubi, buf, pnum, offset, len); err = ubi_io_write_data(ubi, buf, pnum, offset, len);
if (err) { if (err) {
ubi_warn("failed to write %d bytes at offset %d of " ubi_warn("failed to write %d bytes at offset %d of LEB %d:%d, PEB %d",
"LEB %d:%d, PEB %d", len, offset, vol_id, len, offset, vol_id, lnum, pnum);
lnum, pnum);
goto write_error; goto write_error;
} }
} }
...@@ -1040,9 +1038,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, ...@@ -1040,9 +1038,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
* cancel it. * cancel it.
*/ */
if (vol->eba_tbl[lnum] != from) { if (vol->eba_tbl[lnum] != from) {
dbg_wl("LEB %d:%d is no longer mapped to PEB %d, mapped to " dbg_wl("LEB %d:%d is no longer mapped to PEB %d, mapped to PEB %d, cancel",
"PEB %d, cancel", vol_id, lnum, from, vol_id, lnum, from, vol->eba_tbl[lnum]);
vol->eba_tbl[lnum]);
err = MOVE_CANCEL_RACE; err = MOVE_CANCEL_RACE;
goto out_unlock_leb; goto out_unlock_leb;
} }
...@@ -1107,8 +1104,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, ...@@ -1107,8 +1104,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
err = ubi_io_read_vid_hdr(ubi, to, vid_hdr, 1); err = ubi_io_read_vid_hdr(ubi, to, vid_hdr, 1);
if (err) { if (err) {
if (err != UBI_IO_BITFLIPS) { if (err != UBI_IO_BITFLIPS) {
ubi_warn("error %d while reading VID header back from " ubi_warn("error %d while reading VID header back from PEB %d",
"PEB %d", err, to); err, to);
if (is_error_sane(err)) if (is_error_sane(err))
err = MOVE_TARGET_RD_ERR; err = MOVE_TARGET_RD_ERR;
} else } else
...@@ -1134,8 +1131,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, ...@@ -1134,8 +1131,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
err = ubi_io_read_data(ubi, ubi->peb_buf, to, 0, aldata_size); err = ubi_io_read_data(ubi, ubi->peb_buf, to, 0, aldata_size);
if (err) { if (err) {
if (err != UBI_IO_BITFLIPS) { if (err != UBI_IO_BITFLIPS) {
ubi_warn("error %d while reading data back " ubi_warn("error %d while reading data back from PEB %d",
"from PEB %d", err, to); err, to);
if (is_error_sane(err)) if (is_error_sane(err))
err = MOVE_TARGET_RD_ERR; err = MOVE_TARGET_RD_ERR;
} else } else
...@@ -1146,8 +1143,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, ...@@ -1146,8 +1143,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
cond_resched(); cond_resched();
if (crc != crc32(UBI_CRC32_INIT, ubi->peb_buf, data_size)) { if (crc != crc32(UBI_CRC32_INIT, ubi->peb_buf, data_size)) {
ubi_warn("read data back from PEB %d and it is " ubi_warn("read data back from PEB %d and it is different",
"different", to); to);
err = -EINVAL; err = -EINVAL;
goto out_unlock_buf; goto out_unlock_buf;
} }
...@@ -1197,8 +1194,8 @@ static void print_rsvd_warning(struct ubi_device *ubi, ...@@ -1197,8 +1194,8 @@ static void print_rsvd_warning(struct ubi_device *ubi,
return; return;
} }
ubi_warn("cannot reserve enough PEBs for bad PEB handling, reserved %d," ubi_warn("cannot reserve enough PEBs for bad PEB handling, reserved %d, need %d",
" need %d", ubi->beb_rsvd_pebs, ubi->beb_rsvd_level); ubi->beb_rsvd_pebs, ubi->beb_rsvd_level);
if (ubi->corr_peb_count) if (ubi->corr_peb_count)
ubi_warn("%d PEBs are corrupted and not used", ubi_warn("%d PEBs are corrupted and not used",
ubi->corr_peb_count); ubi->corr_peb_count);
......
...@@ -341,9 +341,8 @@ static int gluebi_create(struct ubi_device_info *di, ...@@ -341,9 +341,8 @@ static int gluebi_create(struct ubi_device_info *di,
mutex_lock(&devices_mutex); mutex_lock(&devices_mutex);
g = find_gluebi_nolock(vi->ubi_num, vi->vol_id); g = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
if (g) if (g)
err_msg("gluebi MTD device %d form UBI device %d volume %d " err_msg("gluebi MTD device %d form UBI device %d volume %d already exists",
"already exists", g->mtd.index, vi->ubi_num, g->mtd.index, vi->ubi_num, vi->vol_id);
vi->vol_id);
mutex_unlock(&devices_mutex); mutex_unlock(&devices_mutex);
if (mtd_device_register(mtd, NULL, 0)) { if (mtd_device_register(mtd, NULL, 0)) {
...@@ -376,8 +375,8 @@ static int gluebi_remove(struct ubi_volume_info *vi) ...@@ -376,8 +375,8 @@ static int gluebi_remove(struct ubi_volume_info *vi)
mutex_lock(&devices_mutex); mutex_lock(&devices_mutex);
gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id); gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
if (!gluebi) { if (!gluebi) {
err_msg("got remove notification for unknown UBI device %d " err_msg("got remove notification for unknown UBI device %d volume %d",
"volume %d", vi->ubi_num, vi->vol_id); vi->ubi_num, vi->vol_id);
err = -ENOENT; err = -ENOENT;
} else if (gluebi->refcnt) } else if (gluebi->refcnt)
err = -EBUSY; err = -EBUSY;
...@@ -390,9 +389,8 @@ static int gluebi_remove(struct ubi_volume_info *vi) ...@@ -390,9 +389,8 @@ static int gluebi_remove(struct ubi_volume_info *vi)
mtd = &gluebi->mtd; mtd = &gluebi->mtd;
err = mtd_device_unregister(mtd); err = mtd_device_unregister(mtd);
if (err) { if (err) {
err_msg("cannot remove fake MTD device %d, UBI device %d, " err_msg("cannot remove fake MTD device %d, UBI device %d, volume %d, error %d",
"volume %d, error %d", mtd->index, gluebi->ubi_num, mtd->index, gluebi->ubi_num, gluebi->vol_id, err);
gluebi->vol_id, err);
mutex_lock(&devices_mutex); mutex_lock(&devices_mutex);
list_add_tail(&gluebi->list, &gluebi_devices); list_add_tail(&gluebi->list, &gluebi_devices);
mutex_unlock(&devices_mutex); mutex_unlock(&devices_mutex);
...@@ -422,8 +420,8 @@ static int gluebi_updated(struct ubi_volume_info *vi) ...@@ -422,8 +420,8 @@ static int gluebi_updated(struct ubi_volume_info *vi)
gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id); gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
if (!gluebi) { if (!gluebi) {
mutex_unlock(&devices_mutex); mutex_unlock(&devices_mutex);
err_msg("got update notification for unknown UBI device %d " err_msg("got update notification for unknown UBI device %d volume %d",
"volume %d", vi->ubi_num, vi->vol_id); vi->ubi_num, vi->vol_id);
return -ENOENT; return -ENOENT;
} }
...@@ -449,8 +447,8 @@ static int gluebi_resized(struct ubi_volume_info *vi) ...@@ -449,8 +447,8 @@ static int gluebi_resized(struct ubi_volume_info *vi)
gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id); gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
if (!gluebi) { if (!gluebi) {
mutex_unlock(&devices_mutex); mutex_unlock(&devices_mutex);
err_msg("got update notification for unknown UBI device %d " err_msg("got update notification for unknown UBI device %d volume %d",
"volume %d", vi->ubi_num, vi->vol_id); vi->ubi_num, vi->vol_id);
return -ENOENT; return -ENOENT;
} }
gluebi->mtd.size = vi->used_bytes; gluebi->mtd.size = vi->used_bytes;
...@@ -507,9 +505,9 @@ static void __exit ubi_gluebi_exit(void) ...@@ -507,9 +505,9 @@ static void __exit ubi_gluebi_exit(void)
err = mtd_device_unregister(mtd); err = mtd_device_unregister(mtd);
if (err) if (err)
err_msg("error %d while removing gluebi MTD device %d, " err_msg("error %d while removing gluebi MTD device %d, UBI device %d, volume %d - ignoring",
"UBI device %d, volume %d - ignoring", err, err, mtd->index, gluebi->ubi_num,
mtd->index, gluebi->ubi_num, gluebi->vol_id); gluebi->vol_id);
kfree(mtd->name); kfree(mtd->name);
kfree(gluebi); kfree(gluebi);
} }
......
...@@ -183,15 +183,14 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, ...@@ -183,15 +183,14 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
} }
if (retries++ < UBI_IO_RETRIES) { if (retries++ < UBI_IO_RETRIES) {
ubi_warn("error %d%s while reading %d bytes from PEB " ubi_warn("error %d%s while reading %d bytes from PEB %d:%d, read only %zd bytes, retry",
"%d:%d, read only %zd bytes, retry",
err, errstr, len, pnum, offset, read); err, errstr, len, pnum, offset, read);
yield(); yield();
goto retry; goto retry;
} }
ubi_err("error %d%s while reading %d bytes from PEB %d:%d, " ubi_err("error %d%s while reading %d bytes from PEB %d:%d, read %zd bytes",
"read %zd bytes", err, errstr, len, pnum, offset, read); err, errstr, len, pnum, offset, read);
dump_stack(); dump_stack();
/* /*
...@@ -274,8 +273,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, ...@@ -274,8 +273,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
} }
if (ubi_dbg_is_write_failure(ubi)) { if (ubi_dbg_is_write_failure(ubi)) {
ubi_err("cannot write %d bytes to PEB %d:%d " ubi_err("cannot write %d bytes to PEB %d:%d (emulated)",
"(emulated)", len, pnum, offset); len, pnum, offset);
dump_stack(); dump_stack();
return -EIO; return -EIO;
} }
...@@ -283,8 +282,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, ...@@ -283,8 +282,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
addr = (loff_t)pnum * ubi->peb_size + offset; addr = (loff_t)pnum * ubi->peb_size + offset;
err = mtd_write(ubi->mtd, addr, len, &written, buf); err = mtd_write(ubi->mtd, addr, len, &written, buf);
if (err) { if (err) {
ubi_err("error %d while writing %d bytes to PEB %d:%d, written " ubi_err("error %d while writing %d bytes to PEB %d:%d, written %zd bytes",
"%zd bytes", err, len, pnum, offset, written); err, len, pnum, offset, written);
dump_stack(); dump_stack();
ubi_dump_flash(ubi, pnum, offset, len); ubi_dump_flash(ubi, pnum, offset, len);
} else } else
...@@ -685,8 +684,7 @@ static int validate_ec_hdr(const struct ubi_device *ubi, ...@@ -685,8 +684,7 @@ static int validate_ec_hdr(const struct ubi_device *ubi,
leb_start = be32_to_cpu(ec_hdr->data_offset); leb_start = be32_to_cpu(ec_hdr->data_offset);
if (ec_hdr->version != UBI_VERSION) { if (ec_hdr->version != UBI_VERSION) {
ubi_err("node with incompatible UBI version found: " ubi_err("node with incompatible UBI version found: this UBI version is %d, image version is %d",
"this UBI version is %d, image version is %d",
UBI_VERSION, (int)ec_hdr->version); UBI_VERSION, (int)ec_hdr->version);
goto bad; goto bad;
} }
...@@ -777,10 +775,10 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, ...@@ -777,10 +775,10 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
if (ubi_check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { if (ubi_check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) {
/* The physical eraseblock is supposedly empty */ /* The physical eraseblock is supposedly empty */
if (verbose) if (verbose)
ubi_warn("no EC header found at PEB %d, " ubi_warn("no EC header found at PEB %d, only 0xFF bytes",
"only 0xFF bytes", pnum); pnum);
dbg_bld("no EC header found at PEB %d, " dbg_bld("no EC header found at PEB %d, only 0xFF bytes",
"only 0xFF bytes", pnum); pnum);
if (!read_err) if (!read_err)
return UBI_IO_FF; return UBI_IO_FF;
else else
...@@ -792,12 +790,12 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, ...@@ -792,12 +790,12 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
* 0xFF bytes. Report that the header is corrupted. * 0xFF bytes. Report that the header is corrupted.
*/ */
if (verbose) { if (verbose) {
ubi_warn("bad magic number at PEB %d: %08x instead of " ubi_warn("bad magic number at PEB %d: %08x instead of %08x",
"%08x", pnum, magic, UBI_EC_HDR_MAGIC); pnum, magic, UBI_EC_HDR_MAGIC);
ubi_dump_ec_hdr(ec_hdr); ubi_dump_ec_hdr(ec_hdr);
} }
dbg_bld("bad magic number at PEB %d: %08x instead of " dbg_bld("bad magic number at PEB %d: %08x instead of %08x",
"%08x", pnum, magic, UBI_EC_HDR_MAGIC); pnum, magic, UBI_EC_HDR_MAGIC);
return UBI_IO_BAD_HDR; return UBI_IO_BAD_HDR;
} }
...@@ -806,12 +804,12 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, ...@@ -806,12 +804,12 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
if (hdr_crc != crc) { if (hdr_crc != crc) {
if (verbose) { if (verbose) {
ubi_warn("bad EC header CRC at PEB %d, calculated " ubi_warn("bad EC header CRC at PEB %d, calculated %#08x, read %#08x",
"%#08x, read %#08x", pnum, crc, hdr_crc); pnum, crc, hdr_crc);
ubi_dump_ec_hdr(ec_hdr); ubi_dump_ec_hdr(ec_hdr);
} }
dbg_bld("bad EC header CRC at PEB %d, calculated " dbg_bld("bad EC header CRC at PEB %d, calculated %#08x, read %#08x",
"%#08x, read %#08x", pnum, crc, hdr_crc); pnum, crc, hdr_crc);
if (!read_err) if (!read_err)
return UBI_IO_BAD_HDR; return UBI_IO_BAD_HDR;
...@@ -1032,10 +1030,10 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, ...@@ -1032,10 +1030,10 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
if (ubi_check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { if (ubi_check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) {
if (verbose) if (verbose)
ubi_warn("no VID header found at PEB %d, " ubi_warn("no VID header found at PEB %d, only 0xFF bytes",
"only 0xFF bytes", pnum); pnum);
dbg_bld("no VID header found at PEB %d, " dbg_bld("no VID header found at PEB %d, only 0xFF bytes",
"only 0xFF bytes", pnum); pnum);
if (!read_err) if (!read_err)
return UBI_IO_FF; return UBI_IO_FF;
else else
...@@ -1043,12 +1041,12 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, ...@@ -1043,12 +1041,12 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
} }
if (verbose) { if (verbose) {
ubi_warn("bad magic number at PEB %d: %08x instead of " ubi_warn("bad magic number at PEB %d: %08x instead of %08x",
"%08x", pnum, magic, UBI_VID_HDR_MAGIC); pnum, magic, UBI_VID_HDR_MAGIC);
ubi_dump_vid_hdr(vid_hdr); ubi_dump_vid_hdr(vid_hdr);
} }
dbg_bld("bad magic number at PEB %d: %08x instead of " dbg_bld("bad magic number at PEB %d: %08x instead of %08x",
"%08x", pnum, magic, UBI_VID_HDR_MAGIC); pnum, magic, UBI_VID_HDR_MAGIC);
return UBI_IO_BAD_HDR; return UBI_IO_BAD_HDR;
} }
...@@ -1057,12 +1055,12 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, ...@@ -1057,12 +1055,12 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
if (hdr_crc != crc) { if (hdr_crc != crc) {
if (verbose) { if (verbose) {
ubi_warn("bad CRC at PEB %d, calculated %#08x, " ubi_warn("bad CRC at PEB %d, calculated %#08x, read %#08x",
"read %#08x", pnum, crc, hdr_crc); pnum, crc, hdr_crc);
ubi_dump_vid_hdr(vid_hdr); ubi_dump_vid_hdr(vid_hdr);
} }
dbg_bld("bad CRC at PEB %d, calculated %#08x, " dbg_bld("bad CRC at PEB %d, calculated %#08x, read %#08x",
"read %#08x", pnum, crc, hdr_crc); pnum, crc, hdr_crc);
if (!read_err) if (!read_err)
return UBI_IO_BAD_HDR; return UBI_IO_BAD_HDR;
else else
...@@ -1300,8 +1298,8 @@ static int self_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum) ...@@ -1300,8 +1298,8 @@ static int self_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_EC_HDR_SIZE_CRC); crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_EC_HDR_SIZE_CRC);
hdr_crc = be32_to_cpu(vid_hdr->hdr_crc); hdr_crc = be32_to_cpu(vid_hdr->hdr_crc);
if (hdr_crc != crc) { if (hdr_crc != crc) {
ubi_err("bad VID header CRC at PEB %d, calculated %#08x, " ubi_err("bad VID header CRC at PEB %d, calculated %#08x, read %#08x",
"read %#08x", pnum, crc, hdr_crc); pnum, crc, hdr_crc);
ubi_err("self-check failed for PEB %d", pnum); ubi_err("self-check failed for PEB %d", pnum);
ubi_dump_vid_hdr(vid_hdr); ubi_dump_vid_hdr(vid_hdr);
dump_stack(); dump_stack();
...@@ -1411,15 +1409,15 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len) ...@@ -1411,15 +1409,15 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)
err = mtd_read(ubi->mtd, addr, len, &read, buf); err = mtd_read(ubi->mtd, addr, len, &read, buf);
if (err && !mtd_is_bitflip(err)) { if (err && !mtd_is_bitflip(err)) {
ubi_err("error %d while reading %d bytes from PEB %d:%d, " ubi_err("error %d while reading %d bytes from PEB %d:%d, read %zd bytes",
"read %zd bytes", err, len, pnum, offset, read); err, len, pnum, offset, read);
goto error; goto error;
} }
err = ubi_check_pattern(buf, 0xFF, len); err = ubi_check_pattern(buf, 0xFF, len);
if (err == 0) { if (err == 0) {
ubi_err("flash region at PEB %d:%d, length %d does not " ubi_err("flash region at PEB %d:%d, length %d does not contain all 0xFF bytes",
"contain all 0xFF bytes", pnum, offset, len); pnum, offset, len);
goto fail; goto fail;
} }
......
...@@ -128,9 +128,7 @@ void ubi_calculate_reserved(struct ubi_device *ubi) ...@@ -128,9 +128,7 @@ void ubi_calculate_reserved(struct ubi_device *ubi)
ubi->beb_rsvd_level = ubi->bad_peb_limit - ubi->bad_peb_count; ubi->beb_rsvd_level = ubi->bad_peb_limit - ubi->bad_peb_count;
if (ubi->beb_rsvd_level < 0) { if (ubi->beb_rsvd_level < 0) {
ubi->beb_rsvd_level = 0; ubi->beb_rsvd_level = 0;
ubi_warn("number of bad PEBs (%d) is above the expected limit " ubi_warn("number of bad PEBs (%d) is above the expected limit (%d), not reserving any PEBs for bad PEB handling, will use available PEBs (if any)",
"(%d), not reserving any PEBs for bad PEB handling, "
"will use available PEBs (if any)",
ubi->bad_peb_count, ubi->bad_peb_limit); ubi->bad_peb_count, ubi->bad_peb_limit);
} }
} }
......
...@@ -270,8 +270,8 @@ static int vtbl_check(const struct ubi_device *ubi, ...@@ -270,8 +270,8 @@ static int vtbl_check(const struct ubi_device *ubi,
if (len1 > 0 && len1 == len2 && if (len1 > 0 && len1 == len2 &&
!strncmp(vtbl[i].name, vtbl[n].name, len1)) { !strncmp(vtbl[i].name, vtbl[n].name, len1)) {
ubi_err("volumes %d and %d have the same name" ubi_err("volumes %d and %d have the same name \"%s\"",
" \"%s\"", i, n, vtbl[i].name); i, n, vtbl[i].name);
ubi_dump_vtbl_record(&vtbl[i], i); ubi_dump_vtbl_record(&vtbl[i], i);
ubi_dump_vtbl_record(&vtbl[n], n); ubi_dump_vtbl_record(&vtbl[n], n);
return -EINVAL; return -EINVAL;
...@@ -562,8 +562,8 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -562,8 +562,8 @@ static int init_volumes(struct ubi_device *ubi,
if (vtbl[i].flags & UBI_VTBL_AUTORESIZE_FLG) { if (vtbl[i].flags & UBI_VTBL_AUTORESIZE_FLG) {
/* Auto re-size flag may be set only for one volume */ /* Auto re-size flag may be set only for one volume */
if (ubi->autoresize_vol_id != -1) { if (ubi->autoresize_vol_id != -1) {
ubi_err("more than one auto-resize volume (%d " ubi_err("more than one auto-resize volume (%d and %d)",
"and %d)", ubi->autoresize_vol_id, i); ubi->autoresize_vol_id, i);
kfree(vol); kfree(vol);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment