Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tpm2_i2c_nuvoton: add irq validity check

In 570a3609 IRQ path is incorrectly always exercised while it should be
exercised only when there is an IRQ number allocated. This commit
reverts the old behavior.

[jarkko.sakkinen@linux.intel.com: updated description]

Fixes: 570a36097f3 ("tpm: drop 'irq' from struct tpm_vendor_specific")
Signed-off-by: Andrew Zamansky <andrew.zamansky@nuvoton.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

authored by

Andrew Zamansky and committed by
Jarkko Sakkinen
fa7539b2 9754d45e

+2 -4
+2 -4
drivers/char/tpm/tpm_i2c_nuvoton.c
··· 559 559 * TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT 560 560 * The IRQ should be set in the i2c_board_info (which is done 561 561 * automatically in of_i2c_register_devices, for device tree users */ 562 - chip->flags |= TPM_CHIP_FLAG_IRQ; 563 562 priv->irq = client->irq; 564 - 565 - if (chip->flags & TPM_CHIP_FLAG_IRQ) { 563 + if (client->irq) { 566 564 dev_dbg(dev, "%s() priv->irq\n", __func__); 567 565 rc = devm_request_irq(dev, client->irq, 568 566 i2c_nuvoton_int_handler, ··· 570 572 if (rc) { 571 573 dev_err(dev, "%s() Unable to request irq: %d for use\n", 572 574 __func__, priv->irq); 573 - chip->flags &= ~TPM_CHIP_FLAG_IRQ; 574 575 priv->irq = 0; 575 576 } else { 577 + chip->flags |= TPM_CHIP_FLAG_IRQ; 576 578 /* Clear any pending interrupt */ 577 579 i2c_nuvoton_ready(chip); 578 580 /* - wait for TPM_STS==0xA0 (stsValid, commandReady) */