summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorChen Jun <chenjun102@huawei.com>2021-10-13 06:25:56 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-27 09:04:21 +0100
commitf155b0fbde518857ee2d42f1fbfda6bdf0123363 (patch)
treeff44891b47cd5756912a3c980f83902b289e8a59 /drivers/char
parent0d1c29ffc01a1a6afcc837aaf671fe9dc9e1fd76 (diff)
downloadlinux-stable-f155b0fbde518857ee2d42f1fbfda6bdf0123363.tar.gz
linux-stable-f155b0fbde518857ee2d42f1fbfda6bdf0123363.tar.bz2
linux-stable-f155b0fbde518857ee2d42f1fbfda6bdf0123363.zip
tpm: add request_locality before write TPM_INT_ENABLE
[ Upstream commit 0ef333f5ba7f24f5d8478425c163d3097f1c7afd ] Locality is not appropriately requested before writing the int mask. Add the missing boilerplate. Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks") Signed-off-by: Chen Jun <chenjun102@huawei.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_tis_core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index c9a5f34097df..c95ce9323d77 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -874,7 +874,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
intmask &= ~TPM_GLOBAL_INT_ENABLE;
+
+ rc = request_locality(chip, 0);
+ if (rc < 0) {
+ rc = -ENODEV;
+ goto out_err;
+ }
+
tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
+ release_locality(chip, 0);
rc = tpm2_probe(chip);
if (rc)