aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAndrew Zamansky <andrew.zamansky@nuvoton.com>2016-06-29 05:58:49 -0400
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-07-19 10:43:38 -0400
commitfa7539b27f4a9d0bfaede2f7547c2322ac68f1f2 (patch)
tree6ade4b33f8f4b745a442c6813cda8784aae6ed1e /drivers/char
parent9754d45e997000ad4021bc4606cc266bb38d876f (diff)
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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_i2c_nuvoton.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index 4e32094b761d..826698234336 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -559,10 +559,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
559 * TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT 559 * TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
560 * The IRQ should be set in the i2c_board_info (which is done 560 * The IRQ should be set in the i2c_board_info (which is done
561 * automatically in of_i2c_register_devices, for device tree users */ 561 * automatically in of_i2c_register_devices, for device tree users */
562 chip->flags |= TPM_CHIP_FLAG_IRQ;
563 priv->irq = client->irq; 562 priv->irq = client->irq;
564 563 if (client->irq) {
565 if (chip->flags & TPM_CHIP_FLAG_IRQ) {
566 dev_dbg(dev, "%s() priv->irq\n", __func__); 564 dev_dbg(dev, "%s() priv->irq\n", __func__);
567 rc = devm_request_irq(dev, client->irq, 565 rc = devm_request_irq(dev, client->irq,
568 i2c_nuvoton_int_handler, 566 i2c_nuvoton_int_handler,
@@ -572,9 +570,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
572 if (rc) { 570 if (rc) {
573 dev_err(dev, "%s() Unable to request irq: %d for use\n", 571 dev_err(dev, "%s() Unable to request irq: %d for use\n",
574 __func__, priv->irq); 572 __func__, priv->irq);
575 chip->flags &= ~TPM_CHIP_FLAG_IRQ;
576 priv->irq = 0; 573 priv->irq = 0;
577 } else { 574 } else {
575 chip->flags |= TPM_CHIP_FLAG_IRQ;
578 /* Clear any pending interrupt */ 576 /* Clear any pending interrupt */
579 i2c_nuvoton_ready(chip); 577 i2c_nuvoton_ready(chip);
580 /* - wait for TPM_STS==0xA0 (stsValid, commandReady) */ 578 /* - wait for TPM_STS==0xA0 (stsValid, commandReady) */