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 | 8637980bab3f09157eef20cc65d2eb7393c770fd (patch) | |
tree | 0e9a99bc983a67edc3b3017f4a45a695674cd17e /drivers/block | |
parent | a687fb18cbd061de2092632cf77e6b9dc93cf7cd (diff) |
[PATCH] paride: register_chrdev fix
If the user specified `major=0' (odd thing to do), pg.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/pg.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 6f5df0fad703..79b868254032 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -643,7 +643,8 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t | |||
643 | 643 | ||
644 | static int __init pg_init(void) | 644 | static int __init pg_init(void) |
645 | { | 645 | { |
646 | int unit, err = 0; | 646 | int unit; |
647 | int err; | ||
647 | 648 | ||
648 | if (disable){ | 649 | if (disable){ |
649 | err = -1; | 650 | err = -1; |
@@ -657,16 +658,17 @@ static int __init pg_init(void) | |||
657 | goto out; | 658 | goto out; |
658 | } | 659 | } |
659 | 660 | ||
660 | if (register_chrdev(major, name, &pg_fops)) { | 661 | err = register_chrdev(major, name, &pg_fops); |
662 | if (err < 0) { | ||
661 | printk("pg_init: unable to get major number %d\n", major); | 663 | printk("pg_init: unable to get major number %d\n", major); |
662 | for (unit = 0; unit < PG_UNITS; unit++) { | 664 | for (unit = 0; unit < PG_UNITS; unit++) { |
663 | struct pg *dev = &devices[unit]; | 665 | struct pg *dev = &devices[unit]; |
664 | if (dev->present) | 666 | if (dev->present) |
665 | pi_release(dev->pi); | 667 | pi_release(dev->pi); |
666 | } | 668 | } |
667 | err = -1; | ||
668 | goto out; | 669 | goto out; |
669 | } | 670 | } |
671 | major = err; /* In case the user specified `major=0' (dynamic) */ | ||
670 | pg_class = class_create(THIS_MODULE, "pg"); | 672 | pg_class = class_create(THIS_MODULE, "pg"); |
671 | if (IS_ERR(pg_class)) { | 673 | if (IS_ERR(pg_class)) { |
672 | err = PTR_ERR(pg_class); | 674 | err = PTR_ERR(pg_class); |