aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_atmel.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2005-10-30 18:03:28 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:29 -0500
commitb888c87b7498557d1dbb9de3d4b8402b1bb89193 (patch)
tree31d43ab177ef00fbef3d15c9513ba737029b6d48 /drivers/char/tpm/tpm_atmel.c
parent1b8333b02aa281a2849331ad62ee595c46a1c5ac (diff)
[PATCH] tpm-tidies
- Various whitespace fixes - Use kzalloc() Acked-by: Kylene Hall <kjhall@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm_atmel.c')
-rw-r--r--drivers/char/tpm/tpm_atmel.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index a9100ad3d030..d12ac1a346b5 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -40,7 +40,7 @@ enum tpm_atmel_read_status {
40 ATML_STATUS_READY = 0x08 40 ATML_STATUS_READY = 0x08
41}; 41};
42 42
43static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count) 43static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
44{ 44{
45 u8 status, *hdr = buf; 45 u8 status, *hdr = buf;
46 u32 size; 46 u32 size;
@@ -100,7 +100,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count)
100 return size; 100 return size;
101} 101}
102 102
103static int tpm_atml_send(struct tpm_chip *chip, u8 * buf, size_t count) 103static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count)
104{ 104{
105 int i; 105 int i;
106 106
@@ -159,12 +159,12 @@ static struct tpm_vendor_specific tpm_atmel = {
159 .miscdev = { .fops = &atmel_ops, }, 159 .miscdev = { .fops = &atmel_ops, },
160}; 160};
161 161
162static struct platform_device *pdev = NULL; 162static struct platform_device *pdev;
163 163
164static void __devexit tpm_atml_remove(struct device *dev) 164static void __devexit tpm_atml_remove(struct device *dev)
165{ 165{
166 struct tpm_chip *chip = dev_get_drvdata(dev); 166 struct tpm_chip *chip = dev_get_drvdata(dev);
167 if ( chip ) { 167 if (chip) {
168 release_region(chip->vendor->base, 2); 168 release_region(chip->vendor->base, 2);
169 tpm_remove_hardware(chip->dev); 169 tpm_remove_hardware(chip->dev);
170 } 170 }
@@ -201,19 +201,17 @@ static int __init init_atmel(void)
201 (tpm_read_index(TPM_ADDR, 0x01) != 0x01 )) 201 (tpm_read_index(TPM_ADDR, 0x01) != 0x01 ))
202 return -ENODEV; 202 return -ENODEV;
203 203
204 pdev = kmalloc(sizeof(struct platform_device), GFP_KERNEL); 204 pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
205 if ( !pdev ) 205 if ( !pdev )
206 return -ENOMEM; 206 return -ENOMEM;
207 207
208 memset(pdev, 0, sizeof(struct platform_device));
209
210 pdev->name = "tpm_atmel0"; 208 pdev->name = "tpm_atmel0";
211 pdev->id = -1; 209 pdev->id = -1;
212 pdev->num_resources = 0; 210 pdev->num_resources = 0;
213 pdev->dev.release = tpm_atml_remove; 211 pdev->dev.release = tpm_atml_remove;
214 pdev->dev.driver = &atml_drv; 212 pdev->dev.driver = &atml_drv;
215 213
216 if ((rc=platform_device_register(pdev)) < 0) { 214 if ((rc = platform_device_register(pdev)) < 0) {
217 kfree(pdev); 215 kfree(pdev);
218 pdev = NULL; 216 pdev = NULL;
219 return rc; 217 return rc;
@@ -234,7 +232,8 @@ static int __init init_atmel(void)
234 return rc; 232 return rc;
235 } 233 }
236 234
237 dev_info(&pdev->dev, "Atmel TPM 1.1, Base Address: 0x%x\n", tpm_atmel.base); 235 dev_info(&pdev->dev, "Atmel TPM 1.1, Base Address: 0x%x\n",
236 tpm_atmel.base);
238 return 0; 237 return 0;
239} 238}
240 239