Skip to content

Commit

Permalink
[PATCH] capi: register_chrdev() fix
Browse files Browse the repository at this point in the history
If the user specified `major=0' (odd thing to do), capi.c will use dynamic
allocation.  We need to pick up that major for subsequent unregister_chrdev().

Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Mar 28, 2006
1 parent 829d5f6 commit 6d9eac3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/isdn/capi/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@ static int __init capi_init(void)
{
char *p;
char *compileinfo;
int major_ret;

if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, sizeof(rev));
Expand All @@ -1493,11 +1494,12 @@ static int __init capi_init(void)
} else
strcpy(rev, "1.0");

if (register_chrdev(capi_major, "capi20", &capi_fops)) {
major_ret = register_chrdev(capi_major, "capi20", &capi_fops);
if (major_ret < 0) {
printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);
return -EIO;
return major_ret;
}

capi_major = major_ret;
capi_class = class_create(THIS_MODULE, "capi");
if (IS_ERR(capi_class)) {
unregister_chrdev(capi_major, "capi20");
Expand Down

0 comments on commit 6d9eac3

Please sign in to comment.