diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-28 04:56:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:16:02 -0500 |
commit | 829d5f68ec59ff7c0fdd472132680df8e4b64f3e (patch) | |
tree | 9673303b0141dd6330e2ead5970084260a80884c /drivers/block | |
parent | 8637980bab3f09157eef20cc65d2eb7393c770fd (diff) |
[PATCH] paride-pt: register_chrdev fix
If the user specified `major=0' (odd thing to do), pt.c will use dynamic
allocation. We need to pick up that major for subsequent unregister_chrdev().
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/paride/pt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 715ae5dc88fb..d2013d362403 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -943,7 +943,8 @@ static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, | |||
943 | 943 | ||
944 | static int __init pt_init(void) | 944 | static int __init pt_init(void) |
945 | { | 945 | { |
946 | int unit, err = 0; | 946 | int unit; |
947 | int err; | ||
947 | 948 | ||
948 | if (disable) { | 949 | if (disable) { |
949 | err = -1; | 950 | err = -1; |
@@ -955,14 +956,15 @@ static int __init pt_init(void) | |||
955 | goto out; | 956 | goto out; |
956 | } | 957 | } |
957 | 958 | ||
958 | if (register_chrdev(major, name, &pt_fops)) { | 959 | err = register_chrdev(major, name, &pt_fops); |
960 | if (err < 0) { | ||
959 | printk("pt_init: unable to get major number %d\n", major); | 961 | printk("pt_init: unable to get major number %d\n", major); |
960 | for (unit = 0; unit < PT_UNITS; unit++) | 962 | for (unit = 0; unit < PT_UNITS; unit++) |
961 | if (pt[unit].present) | 963 | if (pt[unit].present) |
962 | pi_release(pt[unit].pi); | 964 | pi_release(pt[unit].pi); |
963 | err = -1; | ||
964 | goto out; | 965 | goto out; |
965 | } | 966 | } |
967 | major = err; | ||
966 | pt_class = class_create(THIS_MODULE, "pt"); | 968 | pt_class = class_create(THIS_MODULE, "pt"); |
967 | if (IS_ERR(pt_class)) { | 969 | if (IS_ERR(pt_class)) { |
968 | err = PTR_ERR(pt_class); | 970 | err = PTR_ERR(pt_class); |