diff mbox series

tpm: ibmvtpm: free irq on the error path in tpm_ibmvtpm_probe()

Message ID 20221119104642.3964551-1-cuigaosheng1@huawei.com (mailing list archive)
State New, archived
Headers show
Series tpm: ibmvtpm: free irq on the error path in tpm_ibmvtpm_probe() | expand

Commit Message

cuigaosheng Nov. 19, 2022, 10:46 a.m. UTC
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 <cuigaosheng1@huawei.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

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));