In tpm_ibmvtpm_probe(), vio_dev->irq has not been freed on the
init_irq_cleanup error path, we need to free it. Fix it.

Fixes: 132f76294744 ("drivers/char/tpm: Add new device driver to support IBM 
vTPM")
Signed-off-by: Gaosheng Cui <cuigaoshe...@huawei.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index d3989b257f42..8c23aabdfc24 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -649,7 +649,7 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
                         tpm_ibmvtpm_driver_name, ibmvtpm);
        if (rc) {
                dev_err(dev, "Error %d register irq 0x%x\n", rc, vio_dev->irq);
-               goto init_irq_cleanup;
+               goto req_irq_cleanup;
        }
 
        rc = vio_enable_interrupts(vio_dev);
@@ -702,6 +702,8 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
 
        return tpm_chip_register(chip);
 init_irq_cleanup:
+       free_irq(vio_dev->irq, ibmvtpm);
+req_irq_cleanup:
        do {
                rc1 = plpar_hcall_norets(H_FREE_CRQ, vio_dev->unit_address);
        } while (rc1 == H_BUSY || H_IS_LONG_BUSY(rc1));
-- 
2.25.1

Reply via email to