diff options
-rw-r--r-- | drivers/char/tpm/tpm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 1156d11f02d9..854475c54f0e 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -464,6 +464,7 @@ void __devexit tpm_remove(struct pci_dev *pci_dev) | |||
464 | 464 | ||
465 | pci_set_drvdata(pci_dev, NULL); | 465 | pci_set_drvdata(pci_dev, NULL); |
466 | misc_deregister(&chip->vendor->miscdev); | 466 | misc_deregister(&chip->vendor->miscdev); |
467 | kfree(&chip->vendor->miscdev.name); | ||
467 | 468 | ||
468 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); | 469 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); |
469 | 470 | ||
@@ -526,7 +527,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); | |||
526 | int tpm_register_hardware(struct pci_dev *pci_dev, | 527 | int tpm_register_hardware(struct pci_dev *pci_dev, |
527 | struct tpm_vendor_specific *entry) | 528 | struct tpm_vendor_specific *entry) |
528 | { | 529 | { |
529 | char devname[7]; | 530 | #define DEVNAME_SIZE 7 |
531 | |||
532 | char *devname; | ||
530 | struct tpm_chip *chip; | 533 | struct tpm_chip *chip; |
531 | int i, j; | 534 | int i, j; |
532 | 535 | ||
@@ -569,7 +572,8 @@ dev_num_search_complete: | |||
569 | else | 572 | else |
570 | chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; | 573 | chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; |
571 | 574 | ||
572 | snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num); | 575 | devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); |
576 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); | ||
573 | chip->vendor->miscdev.name = devname; | 577 | chip->vendor->miscdev.name = devname; |
574 | 578 | ||
575 | chip->vendor->miscdev.dev = &(pci_dev->dev); | 579 | chip->vendor->miscdev.dev = &(pci_dev->dev); |