Skip to content

Commit eba4e01

Browse files
committed
tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed
JIRA: https://issues.redhat.com/browse/RHEL-72765 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit 6d789ad Author: Lino Sanfilippo <l.sanfilippo@kunbus.com> Date: Thu Nov 24 14:55:27 2022 +0100 tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed Both functions tpm_tis_probe_irq_single() and tpm_tis_probe_irq() may setup the interrupts and then return with an error. This case is indicated by a missing TPM_CHIP_FLAG_IRQ flag in chip->flags. Currently the interrupt setup is only undone if tpm_tis_probe_irq_single() fails. Undo the setup also if tpm_tis_probe_irq() fails. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Tested-by: Michael Niewöhner <linux@mniewoehner.de> Tested-by: Jarkko Sakkinen <jarkko@kernel.org> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
1 parent b506324 commit eba4e01

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/char/tpm/tpm_tis_core.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,21 +1082,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
10821082
goto out_err;
10831083
}
10841084

1085-
if (irq) {
1085+
if (irq)
10861086
tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
10871087
irq);
1088-
if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
1089-
dev_err(&chip->dev, FW_BUG
1088+
else
1089+
tpm_tis_probe_irq(chip, intmask);
1090+
1091+
if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
1092+
dev_err(&chip->dev, FW_BUG
10901093
"TPM interrupt not working, polling instead\n");
10911094

1092-
rc = request_locality(chip, 0);
1093-
if (rc < 0)
1094-
goto out_err;
1095-
disable_interrupts(chip);
1096-
release_locality(chip, 0);
1097-
}
1098-
} else {
1099-
tpm_tis_probe_irq(chip, intmask);
1095+
rc = request_locality(chip, 0);
1096+
if (rc < 0)
1097+
goto out_err;
1098+
disable_interrupts(chip);
1099+
release_locality(chip, 0);
11001100
}
11011101
}
11021102

0 commit comments

Comments
 (0)