Skip to content
Snippets Groups Projects
Commit fa7539b2 authored by Andrew Zamansky's avatar Andrew Zamansky Committed by Jarkko Sakkinen
Browse files

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: 570a3609 ("tpm: drop 'irq' from struct tpm_vendor_specific")
Signed-off-by: default avatarAndrew Zamansky <andrew.zamansky@nuvoton.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 9754d45e
No related branches found
No related tags found
No related merge requests found
...@@ -559,10 +559,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client, ...@@ -559,10 +559,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
* TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT * TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
* The IRQ should be set in the i2c_board_info (which is done * The IRQ should be set in the i2c_board_info (which is done
* automatically in of_i2c_register_devices, for device tree users */ * automatically in of_i2c_register_devices, for device tree users */
chip->flags |= TPM_CHIP_FLAG_IRQ;
priv->irq = client->irq; priv->irq = client->irq;
if (client->irq) {
if (chip->flags & TPM_CHIP_FLAG_IRQ) {
dev_dbg(dev, "%s() priv->irq\n", __func__); dev_dbg(dev, "%s() priv->irq\n", __func__);
rc = devm_request_irq(dev, client->irq, rc = devm_request_irq(dev, client->irq,
i2c_nuvoton_int_handler, i2c_nuvoton_int_handler,
...@@ -572,9 +570,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client, ...@@ -572,9 +570,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
if (rc) { if (rc) {
dev_err(dev, "%s() Unable to request irq: %d for use\n", dev_err(dev, "%s() Unable to request irq: %d for use\n",
__func__, priv->irq); __func__, priv->irq);
chip->flags &= ~TPM_CHIP_FLAG_IRQ;
priv->irq = 0; priv->irq = 0;
} else { } else {
chip->flags |= TPM_CHIP_FLAG_IRQ;
/* Clear any pending interrupt */ /* Clear any pending interrupt */
i2c_nuvoton_ready(chip); i2c_nuvoton_ready(chip);
/* - wait for TPM_STS==0xA0 (stsValid, commandReady) */ /* - wait for TPM_STS==0xA0 (stsValid, commandReady) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment