From: Andrew Morton Date: Tue, 28 Mar 2006 09:56:19 +0000 (-0800) Subject: [PATCH] capi: register_chrdev() fix X-Git-Tag: v2.6.17-rc1~252 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d9eac34104654aa129e365b8d48bbb8c957f186;p=linux-2.6 [PATCH] capi: register_chrdev() fix 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 623adbb0d1..9b493f0bec 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -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)); @@ -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");