From 4fba3c3ba5c6b7803f36db7d56a58fa3226458d9 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 25 Apr 2013 15:07:47 +0800 Subject: tpm_tis: missing platform_driver_unregister() on error in init_tis() Add the missing platform_driver_unregister() before return from init_tis() in the device register error handling case. Signed-off-by: Wei Yongjun Signed-off-by: Kent Yoder --- drivers/char/tpm/tpm_tis.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 8a41b6be23a0..4519cb332987 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -884,12 +884,19 @@ static int __init init_tis(void) rc = platform_driver_register(&tis_drv); if (rc < 0) return rc; - if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) - return PTR_ERR(pdev); - if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { - platform_device_unregister(pdev); - platform_driver_unregister(&tis_drv); + pdev = platform_device_register_simple("tpm_tis", -1, NULL, 0); + if (IS_ERR(pdev)) { + rc = PTR_ERR(pdev); + goto err_dev; } + rc = tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0); + if (rc) + goto err_init; + return 0; +err_init: + platform_device_unregister(pdev); +err_dev: + platform_driver_unregister(&tis_drv); return rc; } -- cgit v1.2.3-59-g8ed1b From 1c16c9636cad24f0e654f19e8f73ede0c7bd5540 Mon Sep 17 00:00:00 2001 From: Mimi Zohar Date: Tue, 21 May 2013 10:40:47 -0400 Subject: tpm: move TPM_DIGEST_SIZE defintion IMA requires access to TPM_DIGEST_SIZE definition. This patch moves the definition to . Signed-off-by: Mimi Zohar Signed-off-by: Kent Yoder --- drivers/char/tpm/tpm.h | 1 - include/linux/tpm.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 0770d1d79366..433423288709 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -272,7 +272,6 @@ typedef union { struct tpm_output_header out; } tpm_cmd_header; -#define TPM_DIGEST_SIZE 20 struct tpm_pcrread_out { u8 pcr_result[TPM_DIGEST_SIZE]; } __packed; diff --git a/include/linux/tpm.h b/include/linux/tpm.h index fcb627ff8d3e..9a9051bb1a03 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -22,6 +22,8 @@ #ifndef __LINUX_TPM_H__ #define __LINUX_TPM_H__ +#define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ + /* * Chip num is this value or a valid tpm idx */ -- cgit v1.2.3-59-g8ed1b From e2fa3d799b7471f00adae59ff36260ad8237929f Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Mon, 27 May 2013 21:39:57 +0200 Subject: tpm: fix regression caused by section type conflict of tpm_dev_release() in ppc builds The 8119807 commit reintroduced a regression (error: __ksymtab_tpm_dev_release causes a section type conflict) that was fixed by commit cbb2ed4. Fix it for good by adding the prototype to tpm.h so sparse doesn't complain about it anymore. Reported-by: Tony Camuso Signed-off-by: Peter Huewe --- drivers/char/tpm/tpm.c | 2 +- drivers/char/tpm/tpm.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 7c3b3dcbfbc8..e3c974a6c522 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -1472,7 +1472,7 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release); * Once all references to platform device are down to 0, * release all allocated structures. */ -static void tpm_dev_release(struct device *dev) +void tpm_dev_release(struct device *dev) { struct tpm_chip *chip = dev_get_drvdata(dev); diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 433423288709..a7bfc176ed43 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -332,6 +332,7 @@ extern struct tpm_chip* tpm_register_hardware(struct device *, const struct tpm_vendor_specific *); extern int tpm_open(struct inode *, struct file *); extern int tpm_release(struct inode *, struct file *); +extern void tpm_dev_release(struct device *dev); extern void tpm_dev_vendor_release(struct tpm_chip *); extern ssize_t tpm_write(struct file *, const char __user *, size_t, loff_t *); -- cgit v1.2.3-59-g8ed1b From 640843ada1236da228121bb139829c657ce9993f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 15 Jun 2013 16:23:24 +0200 Subject: tpm: tpm_i2c_infinion: Don't modify i2c_client->driver The I2C client driver is not supposed to modify the client's driver pointer, this is handled by the I2C core. Signed-off-by: Lars-Peter Clausen Signed-off-by: Peter Huewe --- drivers/char/tpm/tpm_i2c_infineon.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index 37d5dcc10ea7..dbc70429c6ff 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -74,7 +74,6 @@ struct tpm_inf_dev { }; static struct tpm_inf_dev tpm_dev; -static struct i2c_driver tpm_tis_i2c_driver; /* * iic_tpm_read() - read from TPM register @@ -744,11 +743,9 @@ static int tpm_tis_i2c_probe(struct i2c_client *client, return -ENODEV; } - client->driver = &tpm_tis_i2c_driver; tpm_dev.client = client; rc = tpm_tis_i2c_init(&client->dev); if (rc != 0) { - client->driver = NULL; tpm_dev.client = NULL; rc = -ENODEV; } -- cgit v1.2.3-59-g8ed1b From 572e5b018ba68d634f30aef71cf04d85c884aa05 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Mon, 24 Jun 2013 01:19:30 +0200 Subject: tpm/tpm_i2c_infineon: Remove unused header file This driver does not use any module parameters anymore, so the inclusion of the header file can be removed. Signed-off-by: Peter Huewe --- drivers/char/tpm/tpm_i2c_infineon.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index dbc70429c6ff..b8735de8ce95 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "tpm.h" -- cgit v1.2.3-59-g8ed1b