[PATCH] brd: return register_blkdev err code when it fails

From: chaiwen
Date: Mon Sep 23 2013 - 08:04:41 EST



Hi Nick

when register_blk fails,no matter what reasons,brd_init always
returns a "-EIO" error code. if brd_init returns the error code
returned by register_blkdev,the formatted error info reported
when module inserting failed(caused by register_blkdev failing)
could be more meaningfull.

Signed-off-by: chaiwen <chaiw.fnst@xxxxxxxxxxxxxx>
---
drivers/block/brd.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 9bf4371..361204d 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -557,6 +557,7 @@ static int __init brd_init(void)
int i, nr;
unsigned long range;
struct brd_device *brd, *next;
+ int ret;

/*
* brd module now has a feature to instantiate underlying device
@@ -602,8 +603,8 @@ static int __init brd_init(void)
range = 1UL << MINORBITS;
}

- if (register_blkdev(RAMDISK_MAJOR, "ramdisk"))
- return -EIO;
+ if (ret = register_blkdev(RAMDISK_MAJOR, "ramdisk"))
+ return ret;

for (i = 0; i < nr; i++) {
brd = brd_alloc(i);
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/