aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2006-12-06 23:37:08 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:35 -0500
commit5d469ec0f40d65b2a0a704402990a43b2dafe197 (patch)
treee633e67ac9387042617f9de843f020d6116b2d84 /drivers/char/tpm/tpm.c
parentdc168427e6250a5a24c59f34afed6538092dab42 (diff)
[PATCH] Correct misc_register return code handling in several drivers
Clean up several code points in which the return code from misc_register is not handled properly. Several modules failed to deregister various hooks when misc_register fails, and this patch cleans them up. Also there are a few modules that legitimately don't care about the failure status of misc register. These drivers however unilaterally call misc_deregister on module unload. Since misc_register doesn't initialize the list_head in the init_routine if it fails, the deregister operation is at risk for oopsing when list_del is called. The initial solution was to manually init the list in the miscdev structure in each of those modules, but the consensus in this thread was to consolodate and do that universally inside misc_register. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Cc: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Kylene Jo Hall <kjhall@us.ibm.com> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: Olaf Hering <olh@suse.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 774fa861169a..33e1f66e39cb 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1155,6 +1155,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1155 1155
1156 if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) { 1156 if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) {
1157 list_del(&chip->list); 1157 list_del(&chip->list);
1158 misc_deregister(&chip->vendor.miscdev);
1158 put_device(dev); 1159 put_device(dev);
1159 clear_bit(chip->dev_num, dev_mask); 1160 clear_bit(chip->dev_num, dev_mask);
1160 kfree(chip); 1161 kfree(chip);