提交 3072928f 编写于 作者: A Andi Shyti 提交者: Rajiv Andrade

tpm: check the chip reference before using it

If a driver calls tpm_dev_vendor_release for a device already released
then the driver will oops.
Signed-off-by: NAndi Shyti <andi.shyti@gmail.com>
Signed-off-by: NPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: NRajiv Andrade <srajiv@linux.vnet.ibm.com>
上级 dad79cb8
......@@ -1330,6 +1330,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);
......@@ -1347,6 +1350,9 @@ void tpm_dev_release(struct device *dev)
{
struct tpm_chip *chip = dev_get_drvdata(dev);
if (!chip)
return;
tpm_dev_vendor_release(chip);
chip->release(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册