aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index a082a2e34252..33e1f66e39cb 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -325,9 +325,9 @@ static void user_reader_timeout(unsigned long ptr)
325 schedule_work(&chip->work); 325 schedule_work(&chip->work);
326} 326}
327 327
328static void timeout_work(void *ptr) 328static void timeout_work(struct work_struct *work)
329{ 329{
330 struct tpm_chip *chip = ptr; 330 struct tpm_chip *chip = container_of(work, struct tpm_chip, work);
331 331
332 down(&chip->buffer_mutex); 332 down(&chip->buffer_mutex);
333 atomic_set(&chip->data_pending, 0); 333 atomic_set(&chip->data_pending, 0);
@@ -1105,7 +1105,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1105 init_MUTEX(&chip->tpm_mutex); 1105 init_MUTEX(&chip->tpm_mutex);
1106 INIT_LIST_HEAD(&chip->list); 1106 INIT_LIST_HEAD(&chip->list);
1107 1107
1108 INIT_WORK(&chip->work, timeout_work, chip); 1108 INIT_WORK(&chip->work, timeout_work);
1109 1109
1110 init_timer(&chip->user_read_timer); 1110 init_timer(&chip->user_read_timer);
1111 chip->user_read_timer.function = user_reader_timeout; 1111 chip->user_read_timer.function = user_reader_timeout;
@@ -1130,7 +1130,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1130 scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); 1130 scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num);
1131 chip->vendor.miscdev.name = devname; 1131 chip->vendor.miscdev.name = devname;
1132 1132
1133 chip->vendor.miscdev.dev = dev; 1133 chip->vendor.miscdev.parent = dev;
1134 chip->dev = get_device(dev); 1134 chip->dev = get_device(dev);
1135 1135
1136 if (misc_register(&chip->vendor.miscdev)) { 1136 if (misc_register(&chip->vendor.miscdev)) {
@@ -1153,7 +1153,15 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1153 1153
1154 spin_unlock(&driver_lock); 1154 spin_unlock(&driver_lock);
1155 1155
1156 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);
1158 misc_deregister(&chip->vendor.miscdev);
1159 put_device(dev);
1160 clear_bit(chip->dev_num, dev_mask);
1161 kfree(chip);
1162 kfree(devname);
1163 return NULL;
1164 }
1157 1165
1158 chip->bios_dir = tpm_bios_log_setup(devname); 1166 chip->bios_dir = tpm_bios_log_setup(devname);
1159 1167