Commit f4480240 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

unregister_blkdev(): return void

Put WARN_ON and fixed all callers of unregister_blkdev().  Now we can make
unregister_blkdev return void.

Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c6d4d634
...@@ -108,13 +108,11 @@ int register_blkdev(unsigned int major, const char *name) ...@@ -108,13 +108,11 @@ int register_blkdev(unsigned int major, const char *name)
EXPORT_SYMBOL(register_blkdev); EXPORT_SYMBOL(register_blkdev);
/* todo: make void - error printk here */ void unregister_blkdev(unsigned int major, const char *name)
int unregister_blkdev(unsigned int major, const char *name)
{ {
struct blk_major_name **n; struct blk_major_name **n;
struct blk_major_name *p = NULL; struct blk_major_name *p = NULL;
int index = major_to_index(major); int index = major_to_index(major);
int ret = 0;
mutex_lock(&block_subsys_lock); mutex_lock(&block_subsys_lock);
for (n = &major_names[index]; *n; n = &(*n)->next) for (n = &major_names[index]; *n; n = &(*n)->next)
...@@ -122,15 +120,12 @@ int unregister_blkdev(unsigned int major, const char *name) ...@@ -122,15 +120,12 @@ int unregister_blkdev(unsigned int major, const char *name)
break; break;
if (!*n || strcmp((*n)->name, name)) { if (!*n || strcmp((*n)->name, name)) {
WARN_ON(1); WARN_ON(1);
ret = -EINVAL;
} else { } else {
p = *n; p = *n;
*n = p->next; *n = p->next;
} }
mutex_unlock(&block_subsys_lock); mutex_unlock(&block_subsys_lock);
kfree(p); kfree(p);
return ret;
} }
EXPORT_SYMBOL(unregister_blkdev); EXPORT_SYMBOL(unregister_blkdev);
......
...@@ -1527,7 +1527,7 @@ extern void putname(const char *name); ...@@ -1527,7 +1527,7 @@ extern void putname(const char *name);
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
extern int register_blkdev(unsigned int, const char *); extern int register_blkdev(unsigned int, const char *);
extern int unregister_blkdev(unsigned int, const char *); extern void unregister_blkdev(unsigned int, const char *);
extern struct block_device *bdget(dev_t); extern struct block_device *bdget(dev_t);
extern void bd_set_size(struct block_device *, loff_t size); extern void bd_set_size(struct block_device *, loff_t size);
extern void bd_forget(struct inode *inode); extern void bd_forget(struct inode *inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment