Skip to content

Commit

Permalink
tpm: fix panic caused by "tpm: Autodetect itpm devices"
Browse files Browse the repository at this point in the history
commit 3f0d3d0 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>
  • Loading branch information
Olof Johansson authored and James Morris committed Jan 24, 2011
1 parent c4ff4b8 commit e5cce6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/char/tpm/tpm_tis.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
"1.2 TPM (device-id 0x%X, rev-id %d)\n",
vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));

if (is_itpm(to_pnp_dev(dev)))
itpm = 1;

if (itpm)
dev_info(dev, "Intel iTPM workaround enabled\n");

Expand Down Expand Up @@ -637,6 +634,9 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
else
interrupts = 0;

if (is_itpm(pnp_dev))
itpm = 1;

return tpm_tis_init(&pnp_dev->dev, start, len, irq);
}

Expand Down

0 comments on commit e5cce6c

Please sign in to comment.