Skip to content

Commit

Permalink
unregister_blkdev(): return void
Browse files Browse the repository at this point in the history
Put WARN_ON and fixed all callers of unregister_blkdev().  Now we can make
unregister_blkdev return void.

Cc: Jens Axboe <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mita authored and Linus Torvalds committed Jul 17, 2007
1 parent c6d4d63 commit f448024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,24 @@ int register_blkdev(unsigned int major, const char *name)

EXPORT_SYMBOL(register_blkdev);

/* todo: make void - error printk here */
int unregister_blkdev(unsigned int major, const char *name)
void unregister_blkdev(unsigned int major, const char *name)
{
struct blk_major_name **n;
struct blk_major_name *p = NULL;
int index = major_to_index(major);
int ret = 0;

mutex_lock(&block_subsys_lock);
for (n = &major_names[index]; *n; n = &(*n)->next)
if ((*n)->major == major)
break;
if (!*n || strcmp((*n)->name, name)) {
WARN_ON(1);
ret = -EINVAL;
} else {
p = *n;
*n = p->next;
}
mutex_unlock(&block_subsys_lock);
kfree(p);

return ret;
}

EXPORT_SYMBOL(unregister_blkdev);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ extern void putname(const char *name);

#ifdef CONFIG_BLOCK
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 void bd_set_size(struct block_device *, loff_t size);
extern void bd_forget(struct inode *inode);
Expand Down

0 comments on commit f448024

Please sign in to comment.