From: Andi S. <and...@gm...> - 2012-05-28 16:23:29
|
If a driver calls tpm_dev_vendor_release for a device already released then the driver will oops. Signed-off-by: Andi Shyti <and...@gm...> Signed-off-by: Peter Huewe <pet...@gm...> --- drivers/char/tpm/tpm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index ad7c732..66e4c12 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -1322,6 +1322,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); void tpm_dev_vendor_release(struct tpm_chip *chip) { + if (!chip) + return; + if (chip->vendor.release) chip->vendor.release(chip->dev); @@ -1337,6 +1340,9 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release); */ void tpm_dev_release(struct device *dev) { + if (!chip) + return; + struct tpm_chip *chip = dev_get_drvdata(dev); tpm_dev_vendor_release(chip); -- 1.7.10 |