lkml.org 
[lkml]   [2013]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] brd: return register_blkdev err code when it fails
Date

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@cn.fujitsu.com>
---
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


\
 
 \ /
  Last update: 2013-09-23 14:21    [W:0.046 / U:1.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site