Skip to content

Commit 6ea39cc

Browse files
Yang YingliangAndi Shyti
authored andcommitted
i2c: amd-mp2: drop free_irq() of devm_request_irq() allocated irq
irq allocated with devm_request_irq() will be freed in devm_irq_release(), using free_irq() in ->remove() will causes a dangling pointer, and a subsequent double free. So remove the free_irq() in the error path and remove path. Fixes: 969864e ("i2c: amd-mp2: use msix/msi if the hardware supports") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20221103121146.99836-1-yangyingliang@huawei.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent 4701f33 commit 6ea39cc

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/i2c/busses/i2c-amd-mp2-pci.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,11 @@ static int amd_mp2_pci_init(struct amd_mp2_dev *privdata,
327327
amd_mp2_irq_isr, irq_flag, dev_name(&pci_dev->dev), privdata);
328328
if (rc) {
329329
pci_err(pci_dev, "Failure requesting irq %i: %d\n", privdata->dev_irq, rc);
330-
goto free_irq_vectors;
330+
goto err_dma_mask;
331331
}
332332

333333
return rc;
334334

335-
free_irq_vectors:
336-
free_irq(privdata->dev_irq, privdata);
337335
err_dma_mask:
338336
pci_clear_master(pci_dev);
339337
err_pci_enable:
@@ -376,7 +374,6 @@ static void amd_mp2_pci_remove(struct pci_dev *pci_dev)
376374
pm_runtime_forbid(&pci_dev->dev);
377375
pm_runtime_get_noresume(&pci_dev->dev);
378376

379-
free_irq(privdata->dev_irq, privdata);
380377
pci_clear_master(pci_dev);
381378

382379
amd_mp2_clear_reg(privdata);

0 commit comments

Comments
 (0)