[PATCH] tpm_tis: Move setting of TPM_CHIP_FLAG_IRQ into tpm_tis_probe_irq_single

From: Stefan Berger
Date: Tue Nov 12 2019 - 15:27:40 EST


From: Stefan Berger <stefanb@xxxxxxxxxxxxx>

Move the setting of the TPM_CHIP_FLAG_IRQ for irq probing into
tpm_tis_probe_irq_single before calling tpm_tis_gen_interrupt.
This move handles error conditions better that may arise if anything
before fails in tpm_tis_probe_irq_single.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
Suggested-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
---
drivers/char/tpm/tpm_tis_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 8af2cee1a762..6b6605890c7d 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -790,6 +790,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
return rc;

priv->irq_tested = false;
+ chip->flags |= TPM_CHIP_FLAG_IRQ;

/* Generate an interrupt by having the core call through to
* tpm_tis_send
@@ -1060,7 +1061,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
}

tpm_chip_start(chip);
- chip->flags |= TPM_CHIP_FLAG_IRQ;
if (irq) {
tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
irq);
--
2.14.5