diff options
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index a919587ed481..63790e975d20 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -502,13 +502,16 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) | |||
502 | mutex_lock(&mtd_table_mutex); | 502 | mutex_lock(&mtd_table_mutex); |
503 | 503 | ||
504 | ret = register_blkdev(tr->major, tr->name); | 504 | ret = register_blkdev(tr->major, tr->name); |
505 | if (ret) { | 505 | if (ret < 0) { |
506 | printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n", | 506 | printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n", |
507 | tr->name, tr->major, ret); | 507 | tr->name, tr->major, ret); |
508 | mutex_unlock(&mtd_table_mutex); | 508 | mutex_unlock(&mtd_table_mutex); |
509 | return ret; | 509 | return ret; |
510 | } | 510 | } |
511 | 511 | ||
512 | if (ret) | ||
513 | tr->major = ret; | ||
514 | |||
512 | tr->blkshift = ffs(tr->blksize) - 1; | 515 | tr->blkshift = ffs(tr->blksize) - 1; |
513 | 516 | ||
514 | INIT_LIST_HEAD(&tr->devs); | 517 | INIT_LIST_HEAD(&tr->devs); |