aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-15 12:56:51 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:14 -0500
commit01f7b309e453dc8499c318f6810f76b606b66134 (patch)
tree7d5d09cbd3e95f9b644859daedecbe2f4cbe797a
parent49dfc299288fe183b62a3f679a40c91b482d6d73 (diff)
UBI: improve error messages
Always print error code with error messages, sometimes it is extremely helpful info. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--drivers/mtd/ubi/build.c13
-rw-r--r--drivers/mtd/ubi/cdev.c3
-rw-r--r--drivers/mtd/ubi/vmt.c11
3 files changed, 19 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index b0791f795056..5490a73deca5 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -211,7 +211,8 @@ out_eraseblock_size:
211out_unregister: 211out_unregister:
212 device_unregister(&ubi->dev); 212 device_unregister(&ubi->dev);
213out: 213out:
214 ubi_err("failed to initialize sysfs for %s", ubi->ubi_name); 214 ubi_err("failed to initialize sysfs for %s, error %d",
215 ubi->ubi_name, err);
215 return err; 216 return err;
216} 217}
217 218
@@ -285,7 +286,7 @@ static int uif_init(struct ubi_device *ubi)
285 286
286 err = cdev_add(&ubi->cdev, dev, 1); 287 err = cdev_add(&ubi->cdev, dev, 1);
287 if (err) { 288 if (err) {
288 ubi_err("cannot add character device %s", ubi->ubi_name); 289 ubi_err("cannot add character device");
289 goto out_unreg; 290 goto out_unreg;
290 } 291 }
291 292
@@ -296,8 +297,10 @@ static int uif_init(struct ubi_device *ubi)
296 for (i = 0; i < ubi->vtbl_slots; i++) 297 for (i = 0; i < ubi->vtbl_slots; i++)
297 if (ubi->volumes[i]) { 298 if (ubi->volumes[i]) {
298 err = ubi_add_volume(ubi, i); 299 err = ubi_add_volume(ubi, i);
299 if (err) 300 if (err) {
301 ubi_err("cannot add volume %d", i);
300 goto out_volumes; 302 goto out_volumes;
303 }
301 } 304 }
302 305
303 return 0; 306 return 0;
@@ -309,6 +312,7 @@ out_cdev:
309 cdev_del(&ubi->cdev); 312 cdev_del(&ubi->cdev);
310out_unreg: 313out_unreg:
311 unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1); 314 unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1);
315 ubi_err("cannot initialize UBI %s, error %d", ubi->ubi_name, err);
312 return err; 316 return err;
313} 317}
314 318
@@ -422,7 +426,8 @@ static int io_init(struct ubi_device *ubi)
422 426
423 /* Make sure minimal I/O unit is power of 2 */ 427 /* Make sure minimal I/O unit is power of 2 */
424 if (!is_power_of_2(ubi->min_io_size)) { 428 if (!is_power_of_2(ubi->min_io_size)) {
425 ubi_err("bad min. I/O unit"); 429 ubi_err("min. I/O unit (%d) is not power of 2",
430 ubi->min_io_size);
426 return -EINVAL; 431 return -EINVAL;
427 } 432 }
428 433
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 9771e7f410c1..12777da47d3b 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -377,7 +377,8 @@ static ssize_t vol_cdev_write(struct file *file, const char __user *buf,
377 377
378 err = ubi_more_update_data(ubi, vol->vol_id, buf, count); 378 err = ubi_more_update_data(ubi, vol->vol_id, buf, count);
379 if (err < 0) { 379 if (err < 0) {
380 ubi_err("cannot write %zd bytes of update data", count); 380 ubi_err("cannot write %zd bytes of update data, error %d",
381 count, err);
381 return err; 382 return err;
382 } 383 }
383 384
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 6609c319c83c..787ce9ec17ae 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -305,7 +305,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
305 dev = MKDEV(MAJOR(ubi->cdev.dev), vol_id + 1); 305 dev = MKDEV(MAJOR(ubi->cdev.dev), vol_id + 1);
306 err = cdev_add(&vol->cdev, dev, 1); 306 err = cdev_add(&vol->cdev, dev, 1);
307 if (err) { 307 if (err) {
308 ubi_err("cannot add character device for volume %d", vol_id); 308 ubi_err("cannot add character device");
309 goto out_mapping; 309 goto out_mapping;
310 } 310 }
311 311
@@ -319,8 +319,10 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
319 vol->dev.class = ubi_class; 319 vol->dev.class = ubi_class;
320 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id); 320 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
321 err = device_register(&vol->dev); 321 err = device_register(&vol->dev);
322 if (err) 322 if (err) {
323 ubi_err("cannot register device");
323 goto out_gluebi; 324 goto out_gluebi;
325 }
324 326
325 err = volume_sysfs_init(ubi, vol); 327 err = volume_sysfs_init(ubi, vol);
326 if (err) 328 if (err)
@@ -364,6 +366,7 @@ out_acc:
364out_unlock: 366out_unlock:
365 spin_unlock(&ubi->volumes_lock); 367 spin_unlock(&ubi->volumes_lock);
366 kfree(vol); 368 kfree(vol);
369 ubi_err("cannot create volume %d, error %d", vol_id, err);
367 return err; 370 return err;
368 371
369 /* 372 /*
@@ -380,6 +383,7 @@ out_sysfs:
380 ubi->volumes[vol_id] = NULL; 383 ubi->volumes[vol_id] = NULL;
381 spin_unlock(&ubi->volumes_lock); 384 spin_unlock(&ubi->volumes_lock);
382 volume_sysfs_close(vol); 385 volume_sysfs_close(vol);
386 ubi_err("cannot create volume %d, error %d", vol_id, err);
383 return err; 387 return err;
384} 388}
385 389
@@ -591,7 +595,8 @@ int ubi_add_volume(struct ubi_device *ubi, int vol_id)
591 dev = MKDEV(MAJOR(ubi->cdev.dev), vol->vol_id + 1); 595 dev = MKDEV(MAJOR(ubi->cdev.dev), vol->vol_id + 1);
592 err = cdev_add(&vol->cdev, dev, 1); 596 err = cdev_add(&vol->cdev, dev, 1);
593 if (err) { 597 if (err) {
594 ubi_err("cannot add character device for volume %d", vol_id); 598 ubi_err("cannot add character device for volume %d, error %d",
599 vol_id, err);
595 return err; 600 return err;
596 } 601 }
597 602