tpm-chip.c (03b22057e8ed2d1df416c9ae8e6e247e0b87ecc8) | tpm-chip.c (745b361e989af21ad40811c2586b60229f870a68) |
---|---|
1/* 2 * Copyright (C) 2004 IBM Corporation 3 * Copyright (C) 2014 Intel Corporation 4 * 5 * Authors: 6 * Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> 7 * Leendert van Doorn <leendert@watson.ibm.com> 8 * Dave Safford <safford@watson.ibm.com> --- 114 unchanged lines hidden (view full) --- 123{ 124 struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev); 125 126 mutex_lock(&idr_lock); 127 idr_remove(&dev_nums_idr, chip->dev_num); 128 mutex_unlock(&idr_lock); 129 130 kfree(chip->log.bios_event_log); | 1/* 2 * Copyright (C) 2004 IBM Corporation 3 * Copyright (C) 2014 Intel Corporation 4 * 5 * Authors: 6 * Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> 7 * Leendert van Doorn <leendert@watson.ibm.com> 8 * Dave Safford <safford@watson.ibm.com> --- 114 unchanged lines hidden (view full) --- 123{ 124 struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev); 125 126 mutex_lock(&idr_lock); 127 idr_remove(&dev_nums_idr, chip->dev_num); 128 mutex_unlock(&idr_lock); 129 130 kfree(chip->log.bios_event_log); |
131 kfree(chip->work_space.context_buf); |
|
131 kfree(chip); 132} 133 134/** 135 * tpm_chip_alloc() - allocate a new struct tpm_chip instance 136 * @pdev: device to which the chip is associated 137 * At this point pdev mst be initialized, but does not have to 138 * be registered --- 45 unchanged lines hidden (view full) --- 184 185 if (!pdev) 186 chip->flags |= TPM_CHIP_FLAG_VIRTUAL; 187 188 cdev_init(&chip->cdev, &tpm_fops); 189 chip->cdev.owner = THIS_MODULE; 190 chip->cdev.kobj.parent = &chip->dev.kobj; 191 | 132 kfree(chip); 133} 134 135/** 136 * tpm_chip_alloc() - allocate a new struct tpm_chip instance 137 * @pdev: device to which the chip is associated 138 * At this point pdev mst be initialized, but does not have to 139 * be registered --- 45 unchanged lines hidden (view full) --- 185 186 if (!pdev) 187 chip->flags |= TPM_CHIP_FLAG_VIRTUAL; 188 189 cdev_init(&chip->cdev, &tpm_fops); 190 chip->cdev.owner = THIS_MODULE; 191 chip->cdev.kobj.parent = &chip->dev.kobj; 192 |
193 chip->work_space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); 194 if (!chip->work_space.context_buf) { 195 rc = -ENOMEM; 196 goto out; 197 } 198 |
|
192 return chip; 193 194out: 195 put_device(&chip->dev); 196 return ERR_PTR(rc); 197} 198EXPORT_SYMBOL_GPL(tpm_chip_alloc); 199 --- 190 unchanged lines hidden --- | 199 return chip; 200 201out: 202 put_device(&chip->dev); 203 return ERR_PTR(rc); 204} 205EXPORT_SYMBOL_GPL(tpm_chip_alloc); 206 --- 190 unchanged lines hidden --- |