diff options
author | Olof Johansson <olof@lixom.net> | 2011-01-06 22:24:01 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-01-23 19:29:55 -0500 |
commit | e5cce6c13c25d9ac56955a3ae2fd562719848172 (patch) | |
tree | 29ed2e65da52bda2d16a77425102f3a8813fcef1 /drivers/char/tpm | |
parent | c4ff4b829ef9e6353c0b133b7adb564a68054979 (diff) |
tpm: fix panic caused by "tpm: Autodetect itpm devices"
commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 adds a check for
PNP device id to the common tpm_tis_init() function, which in some
cases (force=1) will be called without the device being a member of
a pnp_dev. Oopsing and panics ensue.
Move the test up to before the call to tpm_tis_init(), since it
just modifies a global variable anyway.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r-- | drivers/char/tpm/tpm_tis.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index c17a305ecb28..dd21df55689d 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -493,9 +493,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
493 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | 493 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
494 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | 494 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
495 | 495 | ||
496 | if (is_itpm(to_pnp_dev(dev))) | ||
497 | itpm = 1; | ||
498 | |||
499 | if (itpm) | 496 | if (itpm) |
500 | dev_info(dev, "Intel iTPM workaround enabled\n"); | 497 | dev_info(dev, "Intel iTPM workaround enabled\n"); |
501 | 498 | ||
@@ -637,6 +634,9 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
637 | else | 634 | else |
638 | interrupts = 0; | 635 | interrupts = 0; |
639 | 636 | ||
637 | if (is_itpm(pnp_dev)) | ||
638 | itpm = 1; | ||
639 | |||
640 | return tpm_tis_init(&pnp_dev->dev, start, len, irq); | 640 | return tpm_tis_init(&pnp_dev->dev, start, len, irq); |
641 | } | 641 | } |
642 | 642 | ||