Skip to content

Commit

Permalink
tpm2_i2c_nuvoton: add irq validity check
Browse files Browse the repository at this point in the history
In 570a360 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: 570a360 ("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>
  • Loading branch information
Andrew Zamansky authored and Jarkko Sakkinen committed Jul 19, 2016
1 parent 9754d45 commit fa7539b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/char/tpm/tpm_i2c_nuvoton.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
* TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
* The IRQ should be set in the i2c_board_info (which is done
* automatically in of_i2c_register_devices, for device tree users */
chip->flags |= TPM_CHIP_FLAG_IRQ;
priv->irq = client->irq;

if (chip->flags & TPM_CHIP_FLAG_IRQ) {
if (client->irq) {
dev_dbg(dev, "%s() priv->irq\n", __func__);
rc = devm_request_irq(dev, client->irq,
i2c_nuvoton_int_handler,
Expand All @@ -572,9 +570,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
if (rc) {
dev_err(dev, "%s() Unable to request irq: %d for use\n",
__func__, priv->irq);
chip->flags &= ~TPM_CHIP_FLAG_IRQ;
priv->irq = 0;
} else {
chip->flags |= TPM_CHIP_FLAG_IRQ;
/* Clear any pending interrupt */
i2c_nuvoton_ready(chip);
/* - wait for TPM_STS==0xA0 (stsValid, commandReady) */
Expand Down

0 comments on commit fa7539b

Please sign in to comment.