aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/io.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>2012-04-23 23:59:49 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-05-20 13:25:58 -0400
commit25886a368d58edd9bb0f63d4417d2f73592b9dba (patch)
tree1d520825e52db0ca220738ca0704f5318b3814c7 /drivers/mtd/ubi/io.c
parent56b04e3e8b5cbf71c23a739f34f9a9437afa41fb (diff)
UBI: always dump the stack on error
UBI (and UBIFS) are a bit over-engineered WRT debugging. The idea was to link as few as possible when debugging is disabled, but the downside is that most people produce bug reports which are difficult to understand. This patch weeds out the 'ubi_dbg_dump_stack()' function and turns it into 'dump_stack()' - it is always useful to have stack dump in case of an error. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r--drivers/mtd/ubi/io.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 43f1a0011a55..507e0c6113c3 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -198,7 +198,7 @@ retry:
198 198
199 ubi_err("error %d%s while reading %d bytes from PEB %d:%d, " 199 ubi_err("error %d%s while reading %d bytes from PEB %d:%d, "
200 "read %zd bytes", err, errstr, len, pnum, offset, read); 200 "read %zd bytes", err, errstr, len, pnum, offset, read);
201 ubi_dbg_dump_stack(); 201 dump_stack();
202 202
203 /* 203 /*
204 * The driver should never return -EBADMSG if it failed to read 204 * The driver should never return -EBADMSG if it failed to read
@@ -284,7 +284,7 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
284 if (ubi_dbg_is_write_failure(ubi)) { 284 if (ubi_dbg_is_write_failure(ubi)) {
285 dbg_err("cannot write %d bytes to PEB %d:%d " 285 dbg_err("cannot write %d bytes to PEB %d:%d "
286 "(emulated)", len, pnum, offset); 286 "(emulated)", len, pnum, offset);
287 ubi_dbg_dump_stack(); 287 dump_stack();
288 return -EIO; 288 return -EIO;
289 } 289 }
290 290
@@ -293,7 +293,7 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
293 if (err) { 293 if (err) {
294 ubi_err("error %d while writing %d bytes to PEB %d:%d, written " 294 ubi_err("error %d while writing %d bytes to PEB %d:%d, written "
295 "%zd bytes", err, len, pnum, offset, written); 295 "%zd bytes", err, len, pnum, offset, written);
296 ubi_dbg_dump_stack(); 296 dump_stack();
297 ubi_dbg_dump_flash(ubi, pnum, offset, len); 297 ubi_dbg_dump_flash(ubi, pnum, offset, len);
298 } else 298 } else
299 ubi_assert(written == len); 299 ubi_assert(written == len);
@@ -370,7 +370,7 @@ retry:
370 goto retry; 370 goto retry;
371 } 371 }
372 ubi_err("cannot erase PEB %d, error %d", pnum, err); 372 ubi_err("cannot erase PEB %d, error %d", pnum, err);
373 ubi_dbg_dump_stack(); 373 dump_stack();
374 return err; 374 return err;
375 } 375 }
376 376
@@ -388,7 +388,7 @@ retry:
388 goto retry; 388 goto retry;
389 } 389 }
390 ubi_err("cannot erase PEB %d", pnum); 390 ubi_err("cannot erase PEB %d", pnum);
391 ubi_dbg_dump_stack(); 391 dump_stack();
392 return -EIO; 392 return -EIO;
393 } 393 }
394 394
@@ -722,7 +722,7 @@ static int validate_ec_hdr(const struct ubi_device *ubi,
722bad: 722bad:
723 ubi_err("bad EC header"); 723 ubi_err("bad EC header");
724 ubi_dbg_dump_ec_hdr(ec_hdr); 724 ubi_dbg_dump_ec_hdr(ec_hdr);
725 ubi_dbg_dump_stack(); 725 dump_stack();
726 return 1; 726 return 1;
727} 727}
728 728
@@ -998,7 +998,7 @@ static int validate_vid_hdr(const struct ubi_device *ubi,
998bad: 998bad:
999 ubi_err("bad VID header"); 999 ubi_err("bad VID header");
1000 ubi_dbg_dump_vid_hdr(vid_hdr); 1000 ubi_dbg_dump_vid_hdr(vid_hdr);
1001 ubi_dbg_dump_stack(); 1001 dump_stack();
1002 return 1; 1002 return 1;
1003} 1003}
1004 1004
@@ -1153,7 +1153,7 @@ static int paranoid_check_not_bad(const struct ubi_device *ubi, int pnum)
1153 return err; 1153 return err;
1154 1154
1155 ubi_err("paranoid check failed for PEB %d", pnum); 1155 ubi_err("paranoid check failed for PEB %d", pnum);
1156 ubi_dbg_dump_stack(); 1156 dump_stack();
1157 return err > 0 ? -EINVAL : err; 1157 return err > 0 ? -EINVAL : err;
1158} 1158}
1159 1159
@@ -1192,7 +1192,7 @@ static int paranoid_check_ec_hdr(const struct ubi_device *ubi, int pnum,
1192 1192
1193fail: 1193fail:
1194 ubi_dbg_dump_ec_hdr(ec_hdr); 1194 ubi_dbg_dump_ec_hdr(ec_hdr);
1195 ubi_dbg_dump_stack(); 1195 dump_stack();
1196 return -EINVAL; 1196 return -EINVAL;
1197} 1197}
1198 1198
@@ -1227,7 +1227,7 @@ static int paranoid_check_peb_ec_hdr(const struct ubi_device *ubi, int pnum)
1227 ubi_err("bad CRC, calculated %#08x, read %#08x", crc, hdr_crc); 1227 ubi_err("bad CRC, calculated %#08x, read %#08x", crc, hdr_crc);
1228 ubi_err("paranoid check failed for PEB %d", pnum); 1228 ubi_err("paranoid check failed for PEB %d", pnum);
1229 ubi_dbg_dump_ec_hdr(ec_hdr); 1229 ubi_dbg_dump_ec_hdr(ec_hdr);
1230 ubi_dbg_dump_stack(); 1230 dump_stack();
1231 err = -EINVAL; 1231 err = -EINVAL;
1232 goto exit; 1232 goto exit;
1233 } 1233 }
@@ -1275,7 +1275,7 @@ static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum,
1275fail: 1275fail:
1276 ubi_err("paranoid check failed for PEB %d", pnum); 1276 ubi_err("paranoid check failed for PEB %d", pnum);
1277 ubi_dbg_dump_vid_hdr(vid_hdr); 1277 ubi_dbg_dump_vid_hdr(vid_hdr);
1278 ubi_dbg_dump_stack(); 1278 dump_stack();
1279 return -EINVAL; 1279 return -EINVAL;
1280 1280
1281} 1281}
@@ -1315,7 +1315,7 @@ static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
1315 "read %#08x", pnum, crc, hdr_crc); 1315 "read %#08x", pnum, crc, hdr_crc);
1316 ubi_err("paranoid check failed for PEB %d", pnum); 1316 ubi_err("paranoid check failed for PEB %d", pnum);
1317 ubi_dbg_dump_vid_hdr(vid_hdr); 1317 ubi_dbg_dump_vid_hdr(vid_hdr);
1318 ubi_dbg_dump_stack(); 1318 dump_stack();
1319 err = -EINVAL; 1319 err = -EINVAL;
1320 goto exit; 1320 goto exit;
1321 } 1321 }
@@ -1380,7 +1380,7 @@ int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum,
1380 i, i + dump_len); 1380 i, i + dump_len);
1381 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, 1381 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1,
1382 buf1 + i, dump_len, 1); 1382 buf1 + i, dump_len, 1);
1383 ubi_dbg_dump_stack(); 1383 dump_stack();
1384 err = -EINVAL; 1384 err = -EINVAL;
1385 goto out_free; 1385 goto out_free;
1386 } 1386 }
@@ -1443,7 +1443,7 @@ fail:
1443 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, buf, len, 1); 1443 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, buf, len, 1);
1444 err = -EINVAL; 1444 err = -EINVAL;
1445error: 1445error:
1446 ubi_dbg_dump_stack(); 1446 dump_stack();
1447 vfree(buf); 1447 vfree(buf);
1448 return err; 1448 return err;
1449} 1449}